Thread overview
Can somebody explain this memory usage
Apr 02, 2009
Saaa
Apr 02, 2009
Saaa
Apr 02, 2009
Denis Koroskin
Apr 03, 2009
Saaa
Apr 02, 2009
BCS
Apr 03, 2009
Saaa
Apr 03, 2009
torhu
Apr 04, 2009
Kagamin
Apr 04, 2009
Saaa
Apr 04, 2009
Saaa
April 02, 2009
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 :)


April 02, 2009
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 :)
>
> 


April 02, 2009
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.

April 02, 2009
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.


April 03, 2009
> 
> > 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.
April 03, 2009
> 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

April 03, 2009
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.
April 04, 2009
http://www.digitalmars.com/d/2.0/phobos/std_gc.html#minimize
April 04, 2009
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


April 04, 2009
erm.. That is D2, I mean.
> That's D1 ; )