[freetds] Optimizing memory allocation when using dynamic SQL
sf at 4js.com
Sat Jan 19 06:13:08 EST 2008
Frediano Ziglio wrote:
Interesting, I knew about alignment issues, but from an optimization point of
view I have always asked myself if doing several malloc() of little pieces of
memory is really an issue...
We used to have our own mem allocation wrapper to optimize this in our VM but
we have removed it in latest version to just use malloc() as is... allocating
any size of memory...
I really wonder if C runtime library providers (on any platform) did not yet
optimize malloc() to allocate large blocks of memory (I mean, if you allocate
4 bytes, does it really just allocate 4 bytes or does it pick 4b in a memory pool
or whatever and just increment an internal offset)?
This is a real issue for use, as we have different sort of database interfaces
and need to allocate buffers for dynamic SQL result sets...
Note also that such kind of memory optimizations is IMHO not significant if
you compare with database communication... am I wrong?
Any comment/advice is welcome!
Thanks a lot.
More information about the FreeTDS