From: Donal K. F. <don...@ma...> - 2010-02-04 09:14:55
|
On 04/02/2010 06:31, Andy Goth wrote: > How does ckalloc() work? What are its costs? Joe English pointed out that > malloc()'s overhead can be significantly less than eight bytes, depending on > the implementation. But ckalloc() isn't malloc(); as far as I can tell, it > uses malloc() sparingly, subdividing malloc()'ed memory to satisfy demand. > It seems that when RCHECK isn't defined, the overhead per ckalloc() is four > bytes, not counting alignment padding or an occasional malloc(). It depends on compilation options, but with the HEAD, in the threaded case on a 32-bit system other than OSX, there is an overhead of 2 words per allocation plus whatever the system malloc has. (OTOH, the threaded allocator we use is much faster than the system malloc because it has less lock contention.) In the non-threaded case, it depends on whether USE_TCLALLOC is defined - it isn't by default anywhere these days - and without we just use the system memory allocator. Donal. |