On Wednesday, 11 September 2013 at 08:06:37 UTC, monarch_dodra
wrote:
I have a function that will *massively* benefit from having a
persistent internal buffer it can re-use (and grow) from call
to call, instead of re-allocating on every call.
What I don't want is either of:
1. To set a fixed limitation of size, if the user ends up
making repeated calls to something larger to my fixed size.
2. For a single big call which will allocate a HUGE internal
buffer that will consume all my memory.
What I need is some sort of lazy buffer. Basically, the
allocation holds, but I don't want the to prevent the GC from
collecting it if it deems it has gotten too big, or needs more
memory.
Any idea on how to do something like that? Or literature?
I do not know if it fits, but I had a similar problem some time
ago:
http://forum.dlang.org/thread/[email protected]