53 |
52 |
54 DEBUG(misc, 4, "[Pool] (%s) increasing size of pool to %d items (%d bytes)", this->name, this->total_items, this->total_items * this->item_size); |
53 DEBUG(misc, 4, "[Pool] (%s) increasing size of pool to %d items (%d bytes)", this->name, this->total_items, this->total_items * this->item_size); |
55 |
54 |
56 /* Increase the poolsize */ |
55 /* Increase the poolsize */ |
57 this->blocks = ReallocT(this->blocks, this->current_blocks + 1); |
56 this->blocks = ReallocT(this->blocks, this->current_blocks + 1); |
58 if (this->blocks == NULL) error("Pool: (%s) could not allocate memory for blocks", this->name); |
|
59 |
57 |
60 /* Allocate memory to the new block item */ |
58 /* Allocate memory to the new block item */ |
61 this->blocks[this->current_blocks] = MallocT<byte>(this->item_size * (1 << this->block_size_bits)); |
59 this->blocks[this->current_blocks] = MallocT<byte>(this->item_size * (1 << this->block_size_bits)); |
62 if (this->blocks[this->current_blocks] == NULL) |
|
63 error("Pool: (%s) could not allocate memory for blocks", this->name); |
|
64 |
60 |
65 /* Clean the content of the new block */ |
61 /* Clean the content of the new block */ |
66 memset(this->blocks[this->current_blocks], 0, this->item_size * (1 << this->block_size_bits)); |
62 memset(this->blocks[this->current_blocks], 0, this->item_size * (1 << this->block_size_bits)); |
67 |
63 |
68 /* Call a custom function if defined (e.g. to fill indexes) */ |
64 /* Call a custom function if defined (e.g. to fill indexes) */ |