You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Garbage collection mode. While developing using my MemoryPool, I decided to do some weird taboo and override the new and delete operators completely to use a global MemoryPool of the application. Then, I noticed that the pool just keeps filling up since memory is allocated and de-allocated almost randomly by libraries and the system, thus is not sequential as the pool likes it. Using the memory pool scope feature won't help me here - so I decided to add some garbage collection mechanism that keeps a linked chain of all free area in the pool that can be used for further allocation - this seemed to work great so I decided to add it to the library later.
Thread safety mode When I was developing a server application, that obviously requires to do work in parallel, I also had the Idea to override the new and delete operators to speed things up a little. This also required me to add changes to the memory pool, once it will be complete I will also add it to a dedicate release :)
Advanced garbage collection mode The garbage collection feature changes the header of SMemoryUnitHeader to a special header that indicates that the unit was deleted, and is pointing to the previous deleted element (this way the MemoryPool keeps track of all the available deleted data). In advanced garbage collection mode, we want the memory pool, when memory is released, to iterate the deleted units and merge the ones that are close to each other into single units. Accordingly, the freeing procedure will have more latency but will be more optimized for memory consumption while still keeping a speed up over regular memory allocations.
Discussion
Discussion is open about the algorithms used in the MemoryPool that can be affective and speed up the library even more. Personally, I have a couple of different ideas regarding the garbage collection of the pool that can come in different forms and performances and would love to hear your ideas too! :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Changelog
Future Features
While developing using my MemoryPool, I decided to do some weird taboo and override the
newanddeleteoperators completely to use a global MemoryPool of the application. Then, I noticed that the pool just keeps filling up since memory is allocated and de-allocated almost randomly by libraries and the system, thus is not sequential as the pool likes it. Using the memory pool scope feature won't help me here - so I decided to add some garbage collection mechanism that keeps a linked chain of all free area in the pool that can be used for further allocation - this seemed to work great so I decided to add it to the library later.When I was developing a server application, that obviously requires to do work in parallel, I also had the Idea to override the
newanddeleteoperators to speed things up a little. This also required me to add changes to the memory pool, once it will be complete I will also add it to a dedicate release :)The garbage collection feature changes the header of SMemoryUnitHeader to a special header that indicates that the unit was deleted, and is pointing to the previous deleted element (this way the MemoryPool keeps track of all the available deleted data). In advanced garbage collection mode, we want the memory pool, when memory is released, to iterate the deleted units and merge the ones that are close to each other into single units. Accordingly, the freeing procedure will have more latency but will be more optimized for memory consumption while still keeping a speed up over regular memory allocations.
Discussion
Discussion is open about the algorithms used in the MemoryPool that can be affective and speed up the library even more. Personally, I have a couple of different ideas regarding the garbage collection of the pool that can come in different forms and performances and would love to hear your ideas too! :)
This discussion was created from the release CPPShift MemoryPool v2.1.0.
Beta Was this translation helpful? Give feedback.
All reactions