#include <sc_mempool.h>
Static Public メソッド | |
static void * | allocate (std::size_t sz) |
static void | release (void *p, std::size_t sz) |
static void | display_statistics () |
sc_mempool.h の 59 行で定義されています。
void * sc_core::sc_mempool::allocate | ( | std::size_t | sz | ) | [static] |
sc_mempool.cpp の 292 行で定義されています。
00293 { 00294 if (use_default_new) 00295 return ::operator new(sz); 00296 00297 if (the_mempool == 0) { 00298 use_default_new = compute_use_default_new(); 00299 if (use_default_new) 00300 return ::operator new(sz); 00301 00302 // Note that the_mempool is never freed. This is going to cause 00303 // memory leaks when the program exits. 00304 the_mempool = new sc_mempool_int( 1984, sizeof(cell_sizes)/sizeof(cell_sizes[0]) - 1, 8 ); 00305 } 00306 00307 if (sz > (unsigned) the_mempool->max_size) 00308 return ::operator new(sz); 00309 00310 return the_mempool->do_allocate(sz); 00311 }
void sc_core::sc_mempool::release | ( | void * | p, | |
std::size_t | sz | |||
) | [static] |
sc_mempool.cpp の 314 行で定義されています。
00315 { 00316 if (p) { 00317 00318 if (use_default_new || sz > (unsigned) the_mempool->max_size) { 00319 ::operator delete(p); 00320 return; 00321 } 00322 00323 the_mempool->do_release(p, sz); 00324 } 00325 }
void sc_core::sc_mempool::display_statistics | ( | ) | [static] |
sc_mempool.cpp の 328 行で定義されています。
00329 { 00330 if (the_mempool && !use_default_new) { 00331 the_mempool->display_statistics(); 00332 } else { 00333 printf("SystemC info: no memory allocation was done through the memory pool.\n"); 00334 } 00335 }