News for hackers. Stuff that matters.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tptacek on Thursday August 30, 2012 @12:39PM (#4455444)
vectors don't deal with the heap? Huh? Yes they do.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by astrodust on Thursday August 30, 2012 @01:27PM (#4455705)
I think the comment was a bad phrasing of "a vector is a contiguous memory structure, whereas a list is a series of independent allocations at various points in the heap".
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tptacek on Thursday August 30, 2012 @01:38PM (#4455760)
Sure, but also remember that while vectors are better at locality, both vectors and lists can trash the heap; both are making variable sized requests on demand from the allocator.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tedunangst on Thursday August 30, 2012 @01:57PM (#4455856)
Every time I've had to deal with fragmentation, it was due to a small number of large objects. Never large numbers of small objects. ymmv.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by scott_s on Thursday August 30, 2012 @07:23PM (#4457396)
Which is probably thanks to a good memory allocator.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tptacek on Thursday August 30, 2012 @02:56PM (#4456172)
Very definitely not my experience.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tedunangst on Thursday August 30, 2012 @03:39PM (#4456355)
Didn't mean to imply it was always the case. Just a counterpoint to the conventional wisdom that fragmentation is only a problem with lots of tiny objects.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tptacek on Thursday August 30, 2012 @03:42PM (#4456367)
Sorry, we always sound snippy on message boards. I'm not That Guy in real life. Wait no I totally am.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by Daniel_Newby on Thursday August 30, 2012 @02:13PM (#4455933)
I think fein meant heap allocators and deallocators, which vectors rarely use if you are careful.