[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Comments on libmemcached patch?

> For this patch, the amount of data dynamically allocated is not large, a
> few strings of size much less than PATH_MAX of 4096 bytes. According to
> the manpage for malloc the default MMAP_THRESHOLD is at 128kB.
> Alternately asprintf could be used instead of malloc+snprintf, but
> asprintf is not standardized in C or POSIX (yet?). Additionally, it also
> allocates memory from the heap??

It looks like you could use alloca to allocate the memory.  This would
actually improve the performance of the original code, because a more
compact stack will result in a hotter stack.


Reply to: