Solaris Containers: Resource Management and Solaris Zones Developer's Guide

Memory Management

The following table lists the functions associated with extended accounting memory management. The function name is a link to its man page.

Table 3–4 Extended Accounting Memory Management Functions

Link to man page 

Description 

ea_pack_object(3EXACCT)

Converts an exacct object from unpacked (in-memory) representation to packed (in-file) representation.

ea_unpack_object(3EXACCT)

Converts an exacct object from packed (in-file) representation to unpacked (in-memory) representation.

ea_strdup(3EXACCT)

Duplicates a string that is to be stored inside an ea_object_t structure.

ea_strfree(3EXACCT)

Frees a string previously copied by ea_strdup().

ea_alloc(3EXACCT)

Allocates a block of memory of the requested size. This block can be safely passed to libexacct functions, and can be safely freed by any of the ea_free functions.

ea_free(3EXACCT)

Frees a block of memory previously allocated by ea_alloc().

ea_free_object(3EXACCT)

Frees variable-length data in object hierarchy. 

ea_free_item(3EXACCT)

Frees value fields of designated object, if EUP_ALLOC is specified. The object is not freed. ea_free_object() frees the specified object and any attached hierarchy of objects. If the flag argument is set to EUP_ALLOC, ea_free_object() also frees any variable-length data in the object hierarchy. If the flag argument is set to EUP_NOALLOC, ea_free_object() does not free the variable-length data. In particular, these flags should correspond to the flags specified in calls to ea_unpack_object(3EXACCT).

ea_copy_object(3EXACCT)

Copies an ea_object_t. If the source object is part of a chain, only the current object is copied. If the source object is a group, only the group object is copied without its list of members. The group object eg_nobjs and eg_objs fields are set to 0 and NULL respectively. Use ea_copy_tree() to copy recursively a group or a list of items.

ea_copy_object_tree(3EXACCT)

ea_copy_object_tree recursively copies an ea_object_t. All elements in the eo_next list are copied. Any group objects are recursively copied. The returned object can be completely freed with ea_free_object(3EXACCT) by specifying the EUP_ALLOC flag.

ea_get_object_tree()

Reads in nobj top-level objects from the file, returning the same data structure that would have originally been passed to ea_write_object(). On encountering a group object,ea_get_object() reads only the group header part of the group. ea_get_object_tree() reads the group and all its member items, recursing into subrecords if necessary. The returned object data structure can be completely freed with ea_free_object() by specifying the EUP_ALLOC flag.