Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/isayme/mpool
a thread safe memory pool in linux c
https://github.com/isayme/mpool
Last synced: 12 days ago
JSON representation
a thread safe memory pool in linux c
- Host: GitHub
- URL: https://github.com/isayme/mpool
- Owner: isayme
- License: mit
- Created: 2015-01-28T14:02:45.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-02T12:47:24.000Z (almost 10 years ago)
- Last Synced: 2024-04-16T14:21:45.265Z (8 months ago)
- Language: C
- Homepage:
- Size: 148 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mpool
A `thread safe` memory pool in linux c.# APIs
only 4 APIs for this great(?) memory pool.## mpool *mpool_create(size_t nblks, size_t blksize) ##
create memory pool, return the pointer to the memory pool if success otherwise return `NULL`.
`nblks` is the number of memory blocks;
`blksize` is the size of each memory block,## int mpool_destroy(mpool *mp) ##
destroy memory pool. return `0` if success,
and return `-1` when any of below condition occurs:- NULL == mp;
- memory pool already destroyed;## void *mpool_malloc(mpool *mp) ##
malloc a memory block. return a pointer to the alloacted memory if success,
and return `NULL` when any of below condition occurs:- NULL == mp;
- memory pool already destroyed;
- there no free memory block left in memory pool pointed to by `mp`.## int mpool_free(mpool *mp, void *ptr) ##
free the memory space pointed to by `ptr` back to memory pool `mp`, return `0` if success,
and return `-1` when any of below condition occurs:- NULL == mp;
- NULL == ptr;
- memory pool already destroyed;
- the memory pool already full.# Contact #
EMAIL: [[email protected]](mailto:[email protected])