About GC

Alexandr Druzhinin drug2004 at bk.ru
Sun Feb 24 08:38:53 PST 2013


24.02.2013 23:28, Ali Çehreli пишет:
> 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
>
Sorry, this was reduced code and it became non-informative. I didn't 
mean threshold argument of DataStorage.getSnapshot. Saying `threshold` I 
meant the value at which size of used memory stabilizes.
I mean that when if I use bigger value of DATA_SIZE I get more memory 
used and it's normal. But I have no idea how much memory will be used if 
DATA_SIZE changes. And in complex code (i.e. real application) this 
dependence of size of used memory will be unknown for developer?


More information about the Digitalmars-d-learn mailing list