Simple, very fast, malloc library.
More...
#include "meminfo.h"
Go to the source code of this file.
Data Structures
Defines
-
#define F_MALLOC_HASH_BITMAP
- Use a bitmap to quickly find free fragments, should speed up especially startup (non-warmed-up malloc).
-
#define F_MALLOC_OPTIMIZE (1UL<<F_MALLOC_OPTIMIZE_FACTOR)
- Size to optimize for, (most allocs <= this size), must be 2^k.
Hash structure
- 0 ....
F_MALLOC_OPTIMIZE/ROUNDTO - small buckets, size increases with ROUNDTO from bucket to bucket
- +1 .... end - size = 2^k, big buckets
- #define fm_sums(qm) do{}while(0)
- Debugging helper, summary and logs all allocated memory blocks.
- struct fm_block * fm_malloc_init (char *address, unsigned long size)
- Initialize memory manager malloc.
- void * fm_malloc (struct fm_block *qm, unsigned long size)
- Main memory manager allocation function.
- void fm_free (struct fm_block *qm, void *p)
- Main memory manager free function.
- void * fm_realloc (struct fm_block *qm, void *p, unsigned long size)
- Main memory manager realloc function.
- void fm_status (struct fm_block *qm)
- Report internal memory manager status.
- void fm_info (struct fm_block *qm, struct mem_info *info)
- Fills a malloc info structure with info about the block.
- unsigned long fm_available (struct fm_block *qm)
- Helper function for available memory report.
Detailed Description
Definition in file f_malloc.h.
Define Documentation
| #define fm_sums |
( |
|
qm |
) |
do{}while(0) |
Function Documentation
| unsigned long fm_available |
( |
struct fm_block * |
qm |
) |
|
- Parameters:
-
- Returns:
- Returns how much free memory is available, on error (not compiled with bookkeeping code) returns (unsigned long)(-1)
| void fm_free |
( |
struct fm_block * |
qm, |
|
|
void * |
p | |
|
) |
| | |
Main memory manager free function, provide functionality necessary for pkg_free
- Parameters:
-
| qm | memory block |
| p | freed memory |
Fills a malloc info structure with info about the block, if a parameter is not supported, it will be filled with 0
- Parameters:
-
| qm | memory block |
| info | memory information |
| void* fm_malloc |
( |
struct fm_block * |
qm, |
|
|
unsigned long |
size | |
|
) |
| | |
- Parameters:
-
| qm | memory block |
| size | memory allocation size |
- Returns:
- address of allocated memory
| struct fm_block* fm_malloc_init |
( |
char * |
address, |
|
|
unsigned long |
size | |
|
) |
| | [read] |
- Parameters:
-
| address | start address for memory block |
| size | Size of allocation |
- Returns:
- return the fm_block
Referenced by init_pkg_mallocs().
| void* fm_realloc |
( |
struct fm_block * |
qm, |
|
|
void * |
p, |
|
|
unsigned long |
size | |
|
) |
| | |
Main memory manager realloc function, provide functionality for pkg_realloc
- Parameters:
-
| qm | memory block |
| p | reallocated memory block |
| size | |
- Returns:
- reallocated memory block