Changes to VALUE_PAIR structure
aland at deployingradius.com
Wed Nov 23 14:40:01 CET 2011
I've pushed some changes to the VALUE_PAIR structure:
- rearrange struct members to remove padding
This saves ~8 bytes of memory on 64-bit machines
- allocate only the needed part of the "data" field
This prevents allocating 256 entry array for "integers"
The result is that the VP structure is now 52 bytes for most common
attributes (integer, ipaddr), instead of 312. For many VPs, that should
save a *lot* of memory.
I'm also investigating moving the "name", "attribute", and "vendor"
fields out of the VP, and replacing them with a pointer to a DICT_ATTR.
That should save only a small amount of memory, and may not be worth it.
For a busy system managing ~10K requests, each having 10 attributes
(request + control + reply), this means a savings of 25M of memory.
That should in turn raise performance somewhat.
I've taken a sweep through the code to remove everything which assumed
you could print to vp_strvalue for an integer. It looks good, passes
the tests, and shows no valgrind errors. So it should be OK.
Let me know if you have any issues.
I don't see much point in trying to reduce the memory footprint any
further. What would help is allowing arbitrary length strings, but that
requires changing a *lot* of code.
More information about the Freeradius-Devel