Discuss any questions about BEPUphysics or problems encountered.
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Code: Select all
Debug.Assert(totalBlockCount == 0 || !Pinned, "Memory leak warning! Don't let a buffer pool die without unpinning it!");
Does this mean I have to dispose buffer pool?
- Site Admin
- Posts: 4929
- Joined: Tue Jul 04, 2006 4:45 am
Yup- a pool should not have any outstanding allocations when it is being finalized, or else that memory will be permanently lost to the process. Call pool.Clear() to drop all allocations. BufferPool's explicitly implemented Dispose function just calls Clear.
(Notably, if the process is shutting down, clearing the allocations isn't technically required. The OS will free up all the memory.)