RejectedSoftware Forums

Sign up

memory usage increased very fast, why doesn't GC working ?

We use vibe in a data collecting program, as a http server. Thinking of GC in D, we needn't worry about memory allocation and release.
But recently, the memory usage behaviour of the program is abnormal.

Normally, it use about 200~300M memory. Now, once running the memory will increase about 100M per minute. In 10 minutes, it will use more than 1000M, and it is still increasing, So we have to restart the program very often.

The weird thing is the abnormal behaviour may disappear when com piling the program on another computer, or after we compiling it on the same computer a few times.

That's really weird and frustrating. I can't figure out what's wrong and why that happened. I wonder if GC was working when that happened.

The program runs on windows Server 2008, compiled on windows 7 in vs2013 with VisualD.

Can anyone give me some hints on why this strange happened, how to debug it?

Thank you.

Re: memory usage increased very fast, why doesn't GC working ?

On 2017-03-25 03:52, mashomee wrote:

Can anyone give me some hints on why this strange happened, how to debug it?

Perhaps try running with the GC profiler enabled [1].

[1] https://dlang.org/spec/garbage.html#gc_config

/Jacob Carlborg

Re: memory usage increased very fast, why doesn't GC working ?

Am 25.03.2017 um 03:52 schrieb mashomee:

We use vibe in a data collecting program, as a http server. Thinking of GC in D, we needn't worry about memory allocation and release.
But recently, the memory usage behaviour of the program is abnormal.

Normally, it use about 200~300M memory. Now, once running the memory will increase about 100M per minute. In 10 minutes, it will use more than 1000M, and it is still increasing, So we have to restart the program very often.

The weird thing is the abnormal behaviour may disappear when com piling the program on another computer, or after we compiling it on the same computer a few times.

That's really weird and frustrating. I can't figure out what's wrong and why that happened. I wonder if GC was working when that happened.

The program runs on windows Server 2008, compiled on windows 7 in vs2013 with VisualD.

Can anyone give me some hints on why this strange happened, how to debug it?

Thank you.

It sounds a bit like this may be related to false-pointers - values in
memory that look like a valid pointer to the GC, while they just contain
old values or random numbers in reality. At least that would explain the
erratic behavior.

I had experienced an issue with false pointers in the Json struct when
using a union. It now uses a custom implementation that manually
manages a piece of memory. Unfortunately the debugging tools of the GC
are very limited at the moment, so that tracking this down is quite
involved. But building with dub -b profile-gc, as Jacob suggested, can
help to identify possible sources.