About GC

Ali Çehreli acehreli at yahoo.com
Sun Feb 24 08:28:43 PST 2013


On 02/24/2013 06:26 AM, Alexandr Druzhinin wrote:
 > In the following code http://dpaste.dzfl.pl/f4ae16aa
 > memory consumption depends on DATA_SIZE value. Bigger value bigger
 > consumption - it's natural. Consumption starts from some value and
 > continue to some threshold. After reachin this threshold comsumption
 > doesn't enlarge. This threshold depends on DATA_SIZE value and some
 > others.

What have you observed that threshold value to be? Your program has a 
constant 40 for the 'threshold' parameter. Is that the special value?

 > My question is how can I find this threshold to know is this
 > value suitable for real using or I should change something in my code.
 > Is there some guarantee that this threshold will be less than real
 > memory on the box? How can I control this threshold?

I don't understand the question yet but in general such optimizations 
depend on the actual program. You must make measurements to find that 
out for your program.

 > For example if DATA_SIZE = 300 000 memory consumption is 60-70
 > M, 200 000 - ~40M, 100 000 - ~ 18M (win7 64bits dmd 2.062)

I think that behavior is natural too but again, I don't understand the 
threshold from those figures.

 > And it's possible that if application suddenly gets data
 > more than before application may crashes because this threshold
 > oversize than available memory?

Possible. Sometimes, there may be a lot more memory that requested but 
the memory may be fragmented so that there is not any memory chunk as 
large as the requested amount.

Ali



More information about the Digitalmars-d-learn mailing list