How to release the memory of vsg::Array? #1276
-
The function I tested only has these codes,Here is my code:
I thought that at the end of the function, the smart pointer would be destroyed and the memory would be released. However, from the task manager, the memory was not released.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The VSG uses the vsg::Allocator class to do block allocation with affinity between allocation types so similar object/data types get allocated in the same blocks of memory. This is done to improve runtime performance and can make a big difference for applications that are bandwidth limited - real-time graphics is huge bandwidth hog even on the CPU so it's crucial for getting best performance. I recently improved the internal implementation to speed up allocations/deallocations and wrote up this work on this forum. This thread should also give you an idea what it's all about along with performance metrics: #1228 So in your case the vsg::Array and it's allocated data will be allocated in a block of memory that the VSG will keep around until either those blocks are released or at the end of the life of the application. If you want to release any empty blocks just call: vsg::Allocator::instance()->deleteEmptyMemoryBlocks(); |
Beta Was this translation helpful? Give feedback.
-
I get it, I'm going to study this, there's more involved than I expected. Thank you so much. |
Beta Was this translation helpful? Give feedback.
The VSG uses the vsg::Allocator class to do block allocation with affinity between allocation types so similar object/data types get allocated in the same blocks of memory. This is done to improve runtime performance and can make a big difference for applications that are bandwidth limited - real-time graphics is huge bandwidth hog even on the CPU so it's crucial for getting best performance.
I recently improved the internal implementation to speed up allocations/deallocations and wrote up this work on this forum. This thread should also give you an idea what it's all about along with performance metrics: #1228
So in your case the vsg::Array and it's allocated data will be allocated in a …