#include "salloc.h"
#include <stdio.h>
#include <lib/threads/mutex.h>
Include dependency graph for salloc.cc:
Go to the source code of this file.
Defines | |
#define | malloc_usable_size(x) 1 |
Functions | |
void * | _malloc (size_t size) |
void * | _realloc (void *ptr, size_t size) |
void | _free (void *ptr) |
void | LMallocSetLimit (size_t limit) |
void | LMallocGetUsage (struct LMallocUsage *dest) |
void | _LMallocPrintStats () |
void | _LMallocExit () |
void * | _LMalloc (size_t size) |
void | _LFree (void *ptr) |
void * | _LRealloc (void *ptr, size_t size) |
void | _AllocFailure (size_t size) |
Report allocation failure error and exit (internal). | |
void * | LMalloc (size_t size) |
Allocate some memory (internal). | |
void * | LFree (void *ptr) |
Free memory allocated via LMalloc (internal). | |
void * | LRealloc (void *ptr, size_t size) |
Resize memory allocated via LMalloc (internal). | |
Variables | |
FastMutex | mutex |
LMallocUsage | lmu |
|
Definition at line 210 of file salloc.cc. Referenced by _LFree(), _LMalloc(), and _LRealloc(). |
|
Report allocation failure error and exit (internal).
Definition at line 435 of file salloc.cc. References _LMallocExit(). Referenced by LMalloc(), and LRealloc(). |
|
Definition at line 31 of file salloc.cc. References free. Referenced by _LFree(). |
|
Definition at line 278 of file salloc.cc. References _free(), _LMallocExit(), LMallocUsage::curr_used, LMallocUsage::free_calls, lmu, malloc_usable_size, mutex, and LMallocUsage::used_chunks. Referenced by LFree(). |
|
Definition at line 214 of file salloc.cc. References _LMallocExit(), _malloc(), LMallocUsage::alloc_limit, LMallocUsage::curr_used, LMallocUsage::limit_failures, lmu, LMallocUsage::malloc_calls, malloc_usable_size, LMallocUsage::max_used, LMallocUsage::max_used_chunks, mutex, LMallocUsage::real_failures, and LMallocUsage::used_chunks. Referenced by LMalloc(). |
|
Definition at line 93 of file salloc.cc. References _LMallocPrintStats(). Referenced by _AllocFailure(), _LFree(), _LMalloc(), and _LRealloc(). |
|
Definition at line 68 of file salloc.cc. References LMallocUsage::alloc_limit, LMallocUsage::curr_used, LMallocUsage::free_calls, LMALLOC_DEBUGGING, lmu, LMallocUsage::malloc_calls, LMallocUsage::max_used, LMallocUsage::max_used_chunks, LMallocUsage::realloc_calls, USE_MALLOC_USABLE_SIZE, and LMallocUsage::used_chunks. Referenced by _LMallocExit(). |
|
Definition at line 319 of file salloc.cc. References _LMallocExit(), LMallocUsage::alloc_limit, LMallocUsage::curr_used, LFree(), LMallocUsage::limit_failures, LMalloc(), lmu, malloc_usable_size, LMallocUsage::max_used, mutex, LMallocUsage::real_failures, realloc, and LMallocUsage::realloc_calls. Referenced by LRealloc(). |
|
Definition at line 29 of file salloc.cc. References malloc. Referenced by _LMalloc(). |
|
Definition at line 30 of file salloc.cc. References realloc. |
|
Free memory allocated via LMalloc (internal).
For internal use only. These are the internal (de)allocation routines. Do not use these directly but use the below templates ALLOC, REALLOC, FREE instead. Free memory as allocated by LMalloc or LRealloc. If called with a NULL pointer, nothing is done.
Definition at line 453 of file salloc.cc. References _LFree(). Referenced by _LRealloc(), FREE(), LRealloc(), operator delete(), and operator delete[](). |
|
Allocate some memory (internal).
For internal use only. These are the internal (de)allocation routines. Do not use these directly but use the below templates ALLOC, REALLOC, FREE instead.
Definition at line 443 of file salloc.cc. References _AllocFailure(), and _LMalloc(). Referenced by _LRealloc(), ALLOC(), LRealloc(), operator new(), and operator new[](). |
|
Get the LMallocUsage; pass a pointer where to store the values: Definition at line 61 of file salloc.cc. References lmu. Referenced by main(). |
|
Allocation limitation feature: Sets memory usage limit (0 -> no limit) Definition at line 57 of file salloc.cc. References LMallocUsage::alloc_limit, and lmu. |
|
Resize memory allocated via LMalloc (internal).
For internal use only. These are the internal (de)allocation routines. Do not use these directly but use the below templates ALLOC, REALLOC, FREE instead. Re-allocate memory allocated by LMalloc, i.e. change the size of the memory region. A pointer to the new memory region is returned.
Definition at line 461 of file salloc.cc. References _AllocFailure(), _LRealloc(), LFree(), and LMalloc(). Referenced by REALLOC(). |
|
Initial value: { INIT_FIELD(alloc_limit) 0, INIT_FIELD(curr_used) 0, INIT_FIELD(max_used) 0, INIT_FIELD(malloc_calls) 0, INIT_FIELD(realloc_calls) 0, INIT_FIELD(free_calls) 0, INIT_FIELD(used_chunks) 0, INIT_FIELD(max_used_chunks) 0, INIT_FIELD(real_failures) 0, INIT_FIELD(limit_failures) 0 } Definition at line 42 of file salloc.cc. Referenced by _LFree(), _LMalloc(), _LMallocPrintStats(), _LRealloc(), LMallocGetUsage(), and LMallocSetLimit(). |
|
Definition at line 40 of file salloc.cc. Referenced by _LFree(), _LMalloc(), and _LRealloc(). |