Next: Managing Stacks, Up: Memory Management
To replace the default memory manager some resource_set.free
,
resource_set.link
and resource_set.mode
methods along a
resource_set.context
memory management context attribute must be set
in the struct x1f4_attributes_type
record argument of the expression
parsing function. The X1f4_E4_RESOURCE
bit must be set in the flags
argument of the expression parsing function to inform the expression evaluator
that the memory management field are valid and that it has to pay attention to
them.
See Generation Flags.
See struct x1f4_attributes_type.
The three methods are more or less the standard C library free
,
malloc
and realloc
function equivalents. Whenever the expression
evaluator issues a call to any of the three method the memory management
context is passed as the first argument. The memory management context is
otherwise uninterpreted by the expression evaluator.
frees the memory pointed to by its second argument
allocates a memory segment large enough to hold at least the number of bytes specified by its third argument and stores the result at the address pointed to by its second argument
reallocates the memory segment read from the address pointed to by its second argument large enough to hold at least the number of bytes specified by its third argument and stores the result at the address pointed to by its second argument
The methods are expect to return 0 for success, non 0 for failure.