| 98 | } |
| 99 | |
| 100 | void pool_free(struct alloc_pool *ppool, void *pv) |
| 101 | { |
| 102 | struct object_page *cur = ppool->pobjpageHead; |
| 103 | char *obj = (char*)pv; |
| 104 | |
| 105 | for (;cur != NULL;) |
| 106 | { |
| 107 | if (obj >= cur->rgb() && (obj < (cur->rgb() + (OBJECT_PAGE_BUFFER_SIZE * ppool->cbObject)))) |
| 108 | { |
| 109 | // Its on this page |
| 110 | int idx = (obj - cur->rgb()) / ppool->cbObject; |
| 111 | cur->allocmap[idx / OBJ_PAGE_BITS_PER_WORD] &= ~(1ULL << (idx % OBJ_PAGE_BITS_PER_WORD)); |
| 112 | return; |
| 113 | } |
| 114 | cur = cur->pnext; |
| 115 | } |
| 116 | serverLog(LL_WARNING, "obj not from pool"); |
| 117 | sfree(obj); // we don't know where it came from |
| 118 | return; |
| 119 | } |
| 120 | |
| 121 | extern size_t OBJ_ENCODING_EMBSTR_SIZE_LIMIT; |
| 122 | #define EMBSTR_ROBJ_SIZE (sizeof(robj)+sizeof(struct sdshdr8)+OBJ_ENCODING_EMBSTR_SIZE_LIMIT+1) |
no test coverage detected