MonoGame:develop ← Jjagg:scratchpool
opened 10:15PM - 03 Sep 17 UTC
As discussed in #5341. (edit for autoclose: fixes #5341)
I don't think this i…s right as is. Consider the case where a user loads incrementally larger assets. For each asset a new scratch buffer will be created and returned to the pool, staying in memory until game exit.
Maybe it would be better to use a slightly modified version of ByteBufferPool that deletes the smallest buffer from the pool whenever Get is called and there are no buffers that are large enough. That way the pool size won't grow beyond the number of threads that use a buffer from it simultaneously (most often 1).
cc @nkast