www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can somebody explain this memory usage

reply "Saaa" <empty needmail.com> writes:
dmd 1.042 Phobos OpenGl + SDL (Derelict)

mem usage (winxp task manager) = 60MB,  peak = 120MB
gc.fullCollect is run just before mainloop, no change in mem usage

after 10 minutes or so mem usage has stabilized at 70MB
I have localized this to toStringz usage and think this is why tango's 
toStringz has a temp argument.

When I minimize and normalize the window, mem usage goes to 4MB.

I think I don't understand memory (de)allocations.. might be a bad thing :)
Apr 01 2009
next sibling parent reply "Saaa" <empty needmail.com> writes:
I forgot to mention it is about a program I made :D
(not the compiler itself or something)

 dmd 1.042 Phobos OpenGl + SDL (Derelict)

 mem usage (winxp task manager) = 60MB,  peak = 120MB
 gc.fullCollect is run just before mainloop, no change in mem usage

 after 10 minutes or so mem usage has stabilized at 70MB
 I have localized this to toStringz usage and think this is why tango's 
 toStringz has a temp argument.

 When I minimize and normalize the window, mem usage goes to 4MB.

 I think I don't understand memory (de)allocations.. might be a bad thing 
 :)

 
Apr 01 2009
parent reply "Denis Koroskin" <2korden gmail.com> writes:
On Thu, 02 Apr 2009 10:08:52 +0400, Saaa <empty needmail.com> wrote:

 I forgot to mention it is about a program I made :D
 (not the compiler itself or something)
I belive you have a bug in line 42.
 dmd 1.042 Phobos OpenGl + SDL (Derelict)

 mem usage (winxp task manager) = 60MB,  peak = 120MB
 gc.fullCollect is run just before mainloop, no change in mem usage

 after 10 minutes or so mem usage has stabilized at 70MB
 I have localized this to toStringz usage and think this is why tango's
 toStringz has a temp argument.
What's the problem? You allocate some memory, GC removes unreferenced objects.
 When I minimize and normalize the window, mem usage goes to 4MB.

 I think I don't understand memory (de)allocations.. might be a bad thing
 :)
It's and OS who is swapping your memotry when you minimize your application, not Phobos/Tango or whatever.
Apr 02 2009
parent Saaa <empty needmail.com> writes:
 
 I forgot to mention it is about a program I made :D
 (not the compiler itself or something)
I belive you have a bug in line 42.
?
 
 dmd 1.042 Phobos OpenGl + SDL (Derelict)

 mem usage (winxp task manager) = 60MB,  peak = 120MB
 gc.fullCollect is run just before mainloop, no change in mem usage

 after 10 minutes or so mem usage has stabilized at 70MB
 I have localized this to toStringz usage and think this is why tango's
 toStringz has a temp argument.
What's the problem? You allocate some memory, GC removes unreferenced objects.
I mean: calling toStringz(and format) a lot will allocate about 10MB of extra memory.
 
 When I minimize and normalize the window, mem usage goes to 4MB.

 I think I don't understand memory (de)allocations.. might be a bad thing
 :)
It's and OS who is swapping your memotry when you minimize your application, not Phobos/Tango or whatever.
I always thought that memory usage would stay the same if you minimize and then normilize an application.
Apr 03 2009
prev sibling next sibling parent reply BCS <ao pathlink.com> writes:
Reply to Saaa,

 dmd 1.042 Phobos OpenGl + SDL (Derelict)
 
 mem usage (winxp task manager) = 60MB,  peak = 120MB gc.fullCollect is
 run just before mainloop, no change in mem usage
 
 after 10 minutes or so mem usage has stabilized at 70MB
 I have localized this to toStringz usage and think this is why tango's
 toStringz has a temp argument.
 When I minimize and normalize the window, mem usage goes to 4MB.
 
 I think I don't understand memory (de)allocations.. might be a bad
 thing :)
 
For one thing, most runtimes will never return memory the the OS so task manager will never show a drop in memory. What you should be looking at is either the resident set size in task manager or some of the GC stats in the process.
Apr 02 2009
parent reply Saaa <empty needmail.com> writes:
 For one thing, most runtimes will never return memory the the OS so task 
 manager will never show a drop in memory. What you should be looking at is 
 either the resident set size in task manager or some of the GC stats in the 
 process.
What is the resident set size called in winXP taskmanager (Or: which other application should I use to check memory usage)? How can I chek memory stats? D1-phobos Thanks
Apr 03 2009
parent torhu <no spam.invalid> writes:
On 03.04.2009 11:34, Saaa wrote:
 What is the resident set size called in winXP taskmanager (Or: which other
application should I use to check memory usage)?
 How can I chek memory stats? D1-phobos
 Thanks
I believe 'Mem usage' is the resident size. I often use Process Explorer for tracking memory usage, where resident size is called 'working set'. Freely available from sysinternals.com. It's a great tool for performance tuning and general poking around. I can also recommend Process Monitor, for tracking system calls and various other stuff.
Apr 03 2009
prev sibling parent reply Kagamin <spam here.lot> writes:
http://www.digitalmars.com/d/2.0/phobos/std_gc.html#minimize
Apr 04 2009
parent reply "Saaa" <empty needmail.com> writes:
That's D1 ; )

"Kagamin" <spam here.lot> wrote in message 
news:gr7taq$2u2j$1 digitalmars.com...
 http://www.digitalmars.com/d/2.0/phobos/std_gc.html#minimize 
Apr 04 2009
parent "Saaa" <empty needmail.com> writes:
erm.. That is D2, I mean.
 That's D1 ; )
Apr 04 2009