Changes to VALUE_PAIR structure

Arran Cudbard-Bell a.cudbardb at freeradius.org
Wed Nov 23 14:49:16 CET 2011


On 23 Nov 2011, at 14:40, Alan DeKok wrote:

>  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.

I'd imagine that would require a lot of code changes too, there's no API for getting the name of the attribute, you just access the struct member directly.

Though that's more of a grep and replace type thing that anything that requires thought.

>  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.

Mmm arbitrary length strings.

-Arran

Arran Cudbard-Bell
a.cudbardb at freeradius.org

Betelwiki, Betelwiki, Betelwiki.... http://wiki.freeradius.org/ !





More information about the Freeradius-Devel mailing list