|
LIBCOM_API int | dbmfInit (size_t size, int chunkItems) |
| Initialize the facility. More...
|
|
LIBCOM_API void * | dbmfMalloc (size_t bytes) |
| Allocate memory. More...
|
|
LIBCOM_API char * | dbmfStrdup (const char *str) |
| Duplicate a string. More...
|
|
LIBCOM_API char * | dbmfStrndup (const char *str, size_t len) |
| Duplicate a string (up to len bytes). More...
|
|
LIBCOM_API char * | dbmfStrcat3 (const char *lhs, const char *mid, const char *rhs) |
| Concatenate three strings. More...
|
|
LIBCOM_API void | dbmfFree (void *bytes) |
| Free the memory allocated by dbmfMalloc. More...
|
|
LIBCOM_API void | dbmfFreeChunks (void) |
| Free all chunks that contain only free items.
|
|
LIBCOM_API int | dbmfShow (int level) |
| Show the status of the dbmf memory pool. More...
|
|
- Author
- Jim Kowalkowski, Marty Kraimer
Database Macro/Free describes a facility that prevents memory fragmentation when temporary storage is being allocated and freed a short time later, at the same time that much longer-lived storage is also being allocated, such as when parsing items for the IOC database while also creating records.
Routines whin iocCore like dbLoadDatabase() have the following attributes:
- They repeatedly call malloc() followed soon afterwards by a call to free() the temporarily allocated storage.
- Between those calls to malloc() and free(), additional calls to malloc() are made that do NOT have an associated free().
- Note
- In some environment, e.g. vxWorks, this behavior causes severe memory fragmentation.
-
This facility should NOT be used by code that allocates storage and then keeps it for a considerable period of time before releasing. Such code should consider using the freeList library.
Definition in file dbmf.h.