|
Revision 509, 0.9 kB
(checked in by sgrimm, 3 years ago)
|
|
Merge multithreaded into trunk, commit #2 (first commit only did the
new files, not the modified ones.)
|
| Line | |
|---|
| 1 | /* slabs memory allocation */ |
|---|
| 2 | |
|---|
| 3 | /* Init the subsystem. 1st argument is the limit on no. of bytes to allocate, |
|---|
| 4 | 0 if no limit. 2nd argument is the growth factor; each slab will use a chunk |
|---|
| 5 | size equal to the previous slab's chunk size times this factor. */ |
|---|
| 6 | void slabs_init(const size_t limit, const double factor); |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | /* |
|---|
| 10 | * Given object size, return id to use when allocating/freeing memory for object |
|---|
| 11 | * 0 means error: can't store such a large object |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | unsigned int slabs_clsid(const size_t size); |
|---|
| 15 | |
|---|
| 16 | /* Allocate object of given length. 0 on error */ /*@null@*/ |
|---|
| 17 | void *do_slabs_alloc(const size_t size); |
|---|
| 18 | |
|---|
| 19 | /* Free previously allocated object */ |
|---|
| 20 | void do_slabs_free(void *ptr, size_t size); |
|---|
| 21 | |
|---|
| 22 | /* Fill buffer with stats */ /*@null@*/ |
|---|
| 23 | char* do_slabs_stats(int *buflen); |
|---|
| 24 | |
|---|
| 25 | /* Request some slab be moved between classes |
|---|
| 26 | 1 = success |
|---|
| 27 | 0 = fail |
|---|
| 28 | -1 = tried. busy. send again shortly. */ |
|---|
| 29 | int do_slabs_reassign(unsigned char srcid, unsigned char dstid); |
|---|
| 30 | |
|---|