What unpinned mean?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
parapoohda
Posts: 92
Joined: Fri May 31, 2019 6:30 am

What unpinned mean?

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: 4851
Joined: Tue Jul 04, 2006 4:45 am

Re: What unpinned mean?

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.)

parapoohda
Posts: 92
Joined: Fri May 31, 2019 6:30 am

Re: What unpinned mean?

Post by parapoohda » Mon Mar 09, 2020 1:11 am

Thank you

Post Reply