Page 1 of 1

What unpinned mean?

Posted: Sun Mar 08, 2020 8:11 am
by parapoohda

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?

Re: What unpinned mean?

Posted: Sun Mar 08, 2020 8:16 pm
by Norbo
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.)

Re: What unpinned mean?

Posted: Mon Mar 09, 2020 1:11 am
by parapoohda
Thank you