summaryrefslogtreecommitdiff
path: root/keys
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-03-31 21:29:50 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-03-31 21:29:50 +0000
commita009068110039a455bdc916a57d8cd0d0f700da1 (patch)
treeab85731f88b1c616beae92181e46f305c38adad2 /keys
parentd18a0cecdfdb2fae117d768210729254aeb61150 (diff)
Optimizations to the stringfields API
This patch provides a number of optimizations to the stringfields API, focused around saving (not wasting) memory whenever possible. Thanks to Mark Michelson for inspiring this work and coming up with the first two optimizations that are represented here: Changes: - Cleanup of some code, fix incorrect doxygen comments - When a field is emptied or replaced with a new allocation, decrease the amount of 'active' space in the pool it was held in; if that pool reaches zero active space, and is not the current pool, then free it as it is no longer in use - When allocating a pool, try to allocate a size that will fit in a 'standard' malloc() allocation without wasting space - When allocating space for a field, store the amount of space in the two bytes immediately preceding the field; this eliminates the need to call strlen() on the field when overwriting it, and more importantly it 'remembers' the amount of space the field has available, even if a shorter string has been stored in it since it was allocated - Don't automatically double the size of each successive pool allocated; it's wasteful http://reviewboard.digium.com/r/165/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@185581 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'keys')
0 files changed, 0 insertions, 0 deletions