Discuss any questions about BEPUphysics or problems encountered.
-
parapoohda
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Post
by parapoohda » Sun Mar 08, 2020 8:11 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?
-
Norbo
- Site Admin
- Posts: 4929
- Joined: Tue Jul 04, 2006 4:45 am
Post
by Norbo » Sun Mar 08, 2020 8:16 pm
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.)