void acl_dbuf_pool_test(size_t max) { ACL_DBUF_POOL *pool; size_t i, n = 1000000, len, j, k; for (j = 0; j < max; j++) { printf("begin alloc, max: %d\n", (int) n); pool = acl_dbuf_pool_create(0); for (i = 0; i < n; i++) { k = i % 10; switch (k) { case 0: len = 1024; break; case 1: len = 1999; break; case 2: len = 999; break; case 3: len = 230; break; case 4: len = 199; break; case 5: len = 99; break; case 6: len = 19; break; case 7: len = 29; break; case 8: len = 9; break; case 9: len = 399; break; default: len = 88; break; } (void) acl_dbuf_pool_alloc(pool, len); } printf("alloc over now, sleep(10)\n"); sleep(10); acl_dbuf_pool_destroy(pool); } }
void dbuf_pool::operator delete(void* ptr) #endif { dbuf_pool* dbuf = (dbuf_pool*) ptr; acl_dbuf_pool_destroy(dbuf->pool_); }