-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
hello, i am learning the code of gpu memory pool and felt confusing for below code:
| while (current != memory_blocks_.end()) { |
my understanding is: this while loop is to make previous iterator point to the last block and current iterator point to end of block container then we can create a new block after the last block and insert to end of block container.
but why we need below "if"?
i think this would lead to create a new block between previous and current block, seems not make sense....
hollow_begin = previous->data + previous->size;
if (hollow_begin + allocated_size <= current->data) {
memory_block.data = hollow_begin;
memory_block.pitch = 0;
memory_block.size = allocated_size;
host_mutex_.lock();
memory_blocks_.insert_after(previous, memory_block);
host_mutex_.unlock();
return;
}
maybe i missed some logic, please correct me, thank you in advance.
Metadata
Metadata
Assignees
Labels
No labels