Hi Adrian,
At 13:35 22/04/2008, Adrian Chadd wrote:
On Tue, Apr 22, 2008, Guido Serassio wrote:
> >(Linux, Solaris, Windows? :) give the above a whirl and let me know what
> >the
> >output is?
>
> This code is not so clean for Windows: no rusage(), no bzero() and
> some include files are missing ...
Oh, I know it won't compile for Windows. I really should get a Windows
development environment together..
> But I'm getting strange results related to the machine memory usage/size:
>
> Windows XP Professional x64 SP2 with 2 GB RAM
> C:\work\mem-size\Release>memsize.exe test1 131072
> allocating 12, then 4096 byte structures 131072 times..
> RSS: 31321
> C:\work\mem-size\Release>memsize.exe test2 131072
> allocating 4108 byte structure 131072 times..
> RSS: 30183
yeah, thats pretty invalid. :) I wonder if your method for returning
RSS is valid.
When the machine is swapping, I get the low values:
Don't swapping:
C:\>C:\work\mem-size\Release\memsize.exe test1 131072
allocating 12, then 4096 byte structures 131072 times..
RSS: 132982
C:\>C:\work\mem-size\Release\memsize.exe test2 131072
allocating 4108 byte structure 131072 times..
RSS: 132727
Swapping:
C:\>C:\work\mem-size\Release\memsize.exe test1 131072
allocating 12, then 4096 byte structures 131072 times..
RSS: 59395
C:\>C:\work\mem-size\Release\memsize.exe test2 131072
allocating 4108 byte structure 131072 times..
RSS: 100627
It's not so clear what exactly should report ru_maxrss, I have found
the following definition:
"The ru_maxrss member contains the total amount of resident set
memory used. The value will be in terms of memory pages used. "
So, for me "total amount of resident set memory used" should not
count swapped out memory, and according, my ru_maxrss is the process
WorkingSetSize / getpagesize()
Put a getchar() call in before the exit(0); then monitor memory
usage in taskman?
I can confirm around 512 MB used by the application.
Regards
Guido
-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: [EMAIL PROTECTED]
WWW: http://www.acmeconsulting.it/