Greedy memory handling
Namespace
rswhite4 at googlemail.com
Wed Sep 11 04:27:47 PDT 2013
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/wsxajhlsupnraevowcgd@forum.dlang.org
More information about the Digitalmars-d-learn
mailing list