Lhogho
0.0.027
|
Defines | |
#define | DUMP_BUF_SIZE 128 |
Functions | |
void | delete_mem (atom_t a) |
deletes mem atom | |
atom_t | new_mem (uint_t size) |
creates a new mem atom | |
void | dump_mem (atom_t a, int level) |
dumps mem atom |
#define DUMP_BUF_SIZE 128 |
void delete_mem | ( | atom_t | a | ) |
size | size of memory to allocate |
Creates a memory atom with reference count 1.
{ atom_t a = take_from_pool( &data_pool ); REF(a) = 1; ID(a) = MEM_ID; MEMORY(a) = XALLOC( (size_t)size ); ATOMS(a) = empty_list; #ifdef SAFEMODE assert( MEMORY(a) ); #endif //SAFEMODE #ifdef DEBUG_ATOM printf("<ATOM> [%08x] mem={%d bytes}\n",(int)a,size); #endif //DEBUG_ATOM #ifdef ADVANCED stats[ID(a)].allocs++; if( stats[ID(a)].max<(stats[ID(a)].allocs-stats[ID(a)].deallocs) ) stats[ID(a)].max=(stats[ID(a)].allocs-stats[ID(a)].deallocs); stats_free--; #endif //ADVANCED #ifdef DEBUG_RUNTIME_ATOMS if( running_compiled_code ) { outter( TEXT("<RUNTIME> new "), -1 ); dump_atom_address( a ); dump_atom( a, 1 ); outter( TEXT("\n"), -1 ); } #endif #ifdef DEBUG_COMPILETIME_ATOMS if( compiling_code ) { outter( TEXT("<COMPILETIME> new "), -1 ); dump_atom_address( a ); dump_atom( a, 1 ); outter( TEXT("\n"), -1 ); } #endif return a; }
a | atom to dump |
level | dump level |
Dumps mem through the current outter function.
{ #define DUMP_BUF_SIZE 128 char_t buf[DUMP_BUF_SIZE]; int n; n = SPRINTF( buf, DUMP_BUF_SIZE, FORMAT_MEM, (int)MEMORY(a) ); outter( buf, n ); #undef DUMP_BUF_SIZE }