Memory leak with dynamic array
Joseph Wakeling
joseph.wakeling at webdrake.net
Tue Apr 13 05:30:57 PDT 2010
Joseph Wakeling wrote:
> On the other hand, if the assumeSafeAppend takes place outside the loops
> entirely, blow-up occurs -- because the command is not issued after the
> array resize to zero? I've attached examples.
If I include a line
x.reserve(5_000_000);
before the assumeSafeAppend, the memory does not explode indefinitely --
but it uses about 3x as much memory as the 'NoLeak' code even when the
latter lacks advance reservation of memory.
More information about the Digitalmars-d-learn
mailing list