2 #include "libshared_memory_internal.h"
8 /****************************************************************************/
9 void libshared_memory_cleanup( struct libshared_memory_state *ms, void (*memory_cleanup_callback)(enum flag known_numa_node_flag, void *store, lfds710_pal_uint_t size) )
11 struct lfds710_list_asu_element
15 struct libshared_memory_element
18 LFDS710_PAL_ASSERT( ms != NULL );
19 // TRD : memory_cleanup_callback can be NULL
21 if( memory_cleanup_callback != NULL )
23 // TRD : remember that the allocation we're free()ing may contain the list element itself
25 lasue = LFDS710_LIST_ASU_GET_START( ms->list_of_allocations );
27 while( lasue != NULL )
29 lasue_next = LFDS710_LIST_ASU_GET_NEXT( *lasue );
30 me = LFDS710_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue );
31 memory_cleanup_callback( me->known_numa_node_flag, me->original, me->original_memory_size_in_bytes );
36 lfds710_list_asu_cleanup( &ms->list_of_allocations, NULL );