[DGD] Pathological memory allocation?

Felix A. Croes felix at dworkin.nl
Tue Oct 23 22:23:20 CEST 2018


Raymond Jennings <shentino at gmail.com> wrote:

> I'm running an unusual setup, with loads of string and array
> operations and dmemsize is reaching up into a full G with only about
> 40 M actually in use.
>
> Even more interesting, is that dmemsize keeps climbing by the megabyte
> yet actual usage stays fairly low.

You are probably continuously growing arrays and/or strings by appending
to them.  Every time it grows bigger, it has to be reallocated and all
available chunks are too small, thus a lot of memory is wasted.

If so, this is highly inefficient, not just wasteful of memory.  Rewrite
your code.

Regards,
Felix Croes



More information about the DGD mailing list