Lines Matching defs:mpctx

1000 	isc_mempool_t *restrict mpctx = NULL;
1018 mpctx = isc_mem_get(mctx, sizeof(isc_mempool_t));
1020 *mpctx = (isc_mempool_t){
1029 mpctx, file, line, mctx);
1033 isc_mem_attach(mctx, &mpctx->mctx);
1034 mpctx->magic = MEMPOOL_MAGIC;
1036 *mpctxp = (isc_mempool_t *)mpctx;
1039 ISC_LIST_INITANDAPPEND(mctx->pools, mpctx, link);
1045 isc_mempool_setname(isc_mempool_t *restrict mpctx, const char *name) {
1046 REQUIRE(VALID_MEMPOOL(mpctx));
1049 strlcpy(mpctx->name, name, sizeof(mpctx->name));
1054 isc_mempool_t *restrict mpctx = NULL;
1061 mpctx = *mpctxp;
1064 mctx = mpctx->mctx;
1069 mpctx, file, line, mctx);
1073 if (mpctx->allocated > 0) {
1074 UNEXPECTED_ERROR("mempool %s leaked memory", mpctx->name);
1076 REQUIRE(mpctx->allocated == 0);
1081 while (mpctx->items != NULL) {
1082 INSIST(mpctx->freecount > 0);
1083 mpctx->freecount--;
1085 item = mpctx->items;
1086 mpctx->items = item->next;
1088 mem_putstats(mctx, mpctx->size);
1089 mem_put(mctx, item, mpctx->size, 0);
1096 ISC_LIST_UNLINK(mctx->pools, mpctx, link);
1100 mpctx->magic = 0;
1102 isc_mem_putanddetach(&mpctx->mctx, mpctx, sizeof(isc_mempool_t));
1106 isc__mempool_get(isc_mempool_t *restrict mpctx FLARG) {
1109 REQUIRE(VALID_MEMPOOL(mpctx));
1111 mpctx->allocated++;
1113 if (mpctx->items == NULL) {
1114 isc_mem_t *mctx = mpctx->mctx;
1116 const size_t fillcount = mpctx->fillcount;
1124 item = mem_get(mctx, mpctx->size, 0);
1125 mem_getstats(mctx, mpctx->size);
1126 item->next = mpctx->items;
1127 mpctx->items = item;
1128 mpctx->freecount++;
1132 INSIST(mpctx->items != NULL);
1133 item = mpctx->items;
1135 mpctx->items = item->next;
1137 INSIST(mpctx->freecount > 0);
1138 mpctx->freecount--;
1139 mpctx->gets++;
1141 ADD_TRACE(mpctx->mctx, item, mpctx->size, file, line);
1148 isc__mempool_put(isc_mempool_t *restrict mpctx, void *mem FLARG) {
1151 REQUIRE(VALID_MEMPOOL(mpctx));
1154 isc_mem_t *mctx = mpctx->mctx;
1155 const size_t freecount = mpctx->freecount;
1157 const size_t freemax = mpctx->freemax;
1162 INSIST(mpctx->allocated > 0);
1163 mpctx->allocated--;
1165 DELETE_TRACE(mctx, mem, mpctx->size, file, line);
1171 mem_putstats(mctx, mpctx->size);
1172 mem_put(mctx, mem, mpctx->size, 0);
1180 item->next = mpctx->items;
1181 mpctx->items = item;
1182 mpctx->freecount++;
1190 isc_mempool_setfreemax(isc_mempool_t *restrict mpctx,
1192 REQUIRE(VALID_MEMPOOL(mpctx));
1193 mpctx->freemax = limit;
1197 isc_mempool_getfreemax(isc_mempool_t *restrict mpctx) {
1198 REQUIRE(VALID_MEMPOOL(mpctx));
1200 return mpctx->freemax;
1204 isc_mempool_getfreecount(isc_mempool_t *restrict mpctx) {
1205 REQUIRE(VALID_MEMPOOL(mpctx));
1207 return mpctx->freecount;
1211 isc_mempool_getallocated(isc_mempool_t *restrict mpctx) {
1212 REQUIRE(VALID_MEMPOOL(mpctx));
1214 return mpctx->allocated;
1218 isc_mempool_setfillcount(isc_mempool_t *restrict mpctx,
1220 REQUIRE(VALID_MEMPOOL(mpctx));
1223 mpctx->fillcount = limit;
1227 isc_mempool_getfillcount(isc_mempool_t *restrict mpctx) {
1228 REQUIRE(VALID_MEMPOOL(mpctx));
1230 return mpctx->fillcount;