[DGD] Pathological memory allocation?

Raymond Jennings shentino at gmail.com
Wed Oct 24 00:05:25 CEST 2018


Does that still apply even if there is an upper bound on the lengths
of said arrays and strings?

The arrays never grow beyond 80 elements and string sizes are capped
at around 4k

Would even that normally cause a full 8 gigabytes of dynamic memory to
be allocated with only 100 megabytes in use?

Honestly with figures like that I'm tempted to send you a core dump
with a binary.

On Tue, Oct 23, 2018 at 1:23 PM Felix A. Croes <felix at dworkin.nl> wrote:
>
> 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
> ____________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd



More information about the DGD mailing list