blob: 0893189010c4c34c549089fe6c02f33d460bdf64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/** \file halloc.h
A hierarchical memory allocation system. Works just like talloc
used in Samba, except that an arbitrary block allocated with
malloc() can be registered to be freed by halloc_free.
*/
/**
Allocate new memory using specified parent memory context. If \c
context is null, a new root context is created. Context _must_ be
either 0 or the result of a previous call to halloc.
If \c context is null, the resulting block must be freed with a
call to halloc_free().
If \c context is not null, the resulting memory block must never be
explicitly freed, it will be automatically freed whenever the
parent context is freed.
*/
void *halloc( void *context, size_t size );
/**
Free memory context and all children contexts. Only root contexts
may be freed explicitly.
*/
void halloc_free( void *context );
/**
Free the memory pointed to by \c data when the memory pointed to by
\c context is free:d. Note that this will _not_ turn the specified
memory area into a valid halloc context. Only memory areas created
using a call to halloc() can be used as a context.
*/
void *halloc_register( void *context, void *data );
|