Earlier quoted context omitted.
Unfortunately, not for the moment.
I'd also like to put in a request for either open-sourcing or a more detailed overview of the implementations, they sound really interesting.
Memory – Part 4: Intersec’s custom allocators
21–30 of 62 posts
Re: Memory – Part 4: Intersec’s custom allocators
#22Earlier quoted context omitted.
8-byte mallocs are expensive because most mallocs have per-allocation memory overhead to track things. This is exactly why you may want to use a different allocator. IOW, you're angle is that instead of finding a solution to the problem, instead choose a different problem. You don't always have that luxury. My background on this problem is compilers. Compilers allocate lots of little structures that represent tree no…
> 8-byte mallocs are expensive because most mallocs have per-allocation memory overhead to track things. This is exactly why you may want to use a different allocator. I guess if the objective of the article is to point out the obvious fact that mallocing 8 bytes at a time is a bad idea, then showing up some actual numbers from actual malloc implementations is a good idea. However, even small objects in practical pro…
Re: Memory – Part 4: Intersec’s custom allocators
#23The fact that returning memory to the Kernel is hard is supported by the circumstance, that most allocators will use brk/sbrk to resize the data segment of the executing process to allocate memory, at least if they shall allocate few memory. The other fact, that allocators have to lock global data structures is also not true. Most modern operating systems supports thread-local storage and therefore you don't need loc…
The average string length in most programs is about 5 to 10 bytes. Plenty of well written software works with strings like that.
Re: Memory – Part 4: Intersec’s custom allocators
#24Earlier quoted context omitted.
Yes, I wish that cleanup was a portable C feature! Glad to see that GNU is trying something here, as it would serve as a prototype for standardization. Perhaps in a future version of C...
There is an extended version of C, which is has this feature and is nearly as widely ported as C. They aptly named it C++.
Re: Memory – Part 4: Intersec’s custom allocators
#25Earlier quoted context omitted.
Is the source for the allocators freely available? Would love to study those.
Unfortunately, not for the moment.
Re: Memory – Part 4: Intersec’s custom allocators
#26Earlier quoted context omitted.
Unfortunately, not for the moment.
In lieu of the implementation, I'd like to know if these allocators are themselves based on malloc or if you have some tricky assembly/kernel code going on somewhere.
Re: Memory – Part 4: Intersec’s custom allocators
#27Earlier quoted context omitted.
> 8-byte mallocs are expensive because most mallocs have per-allocation memory overhead to track things. This is exactly why you may want to use a different allocator. I guess if the objective of the article is to point out the obvious fact that mallocing 8 bytes at a time is a bad idea, then showing up some actual numbers from actual malloc implementations is a good idea. However, even small objects in practical pro…
I kinda see it more as "we're using an unrealistic workload to emphasize the per-malloc overhead". A program that was written to minimize and batch allocations wouldn't be as demonstrative.
It's a little like those C programmers who try to use 256 byte static arrays for all their strings because they don't quite grok malloc/realloc.
Re: Memory – Part 4: Intersec’s custom allocators
#28It should be obvious that a lot of 8 byte mallocs will give bad performance and horrible memory use. This article and in particular the benchmarks in it would be a lot more informative if the test case was more realistic. Please add at least 32 or 64 bytes of payload to the linked list structure and re-run the benchmarks. Even that is a very small allocation block, but is on the lower end of realistic allocation size…
Re: Memory – Part 4: Intersec’s custom allocators
#29Earlier quoted context omitted.
I kinda see it more as "we're using an unrealistic workload to emphasize the per-malloc overhead". A program that was written to minimize and batch allocations wouldn't be as demonstrative.
Contra "exDM69", there's nothing unreasonable or "unrealistic" about allocating 8 bytes at a time; it's in fact extremely convenient to be able to do that. I think it's telling that someone would call that workload unrealistic; it indicates to me that they've never even really considered alternatives to malloc. It's a little like those C programmers who try to use 256 byte static arrays for all their strings because…
But if I were writing a bigger application entirely in C/C++, I could totally see lots of small allocations happening at different points (and getting into wackiness with custom pooled allocators and auto_ptr).
Re: Memory – Part 4: Intersec’s custom allocators
#30Earlier quoted context omitted.
Yes, I wish that cleanup was a portable C feature! Glad to see that GNU is trying something here, as it would serve as a prototype for standardization. Perhaps in a future version of C...
There is an extended version of C, which is has this feature and is nearly as widely ported as C. They aptly named it C++.