Hi Adrian,

At 07:51 21/04/2008, Adrian Chadd wrote:
(This also may be an issue in Squid-3, as the mem_node class stores the data
inline.)

I did a little poking with the FreeBSD allocator - it allocates non-tiny
objects on page boundaries with a size rounded up to the next page.

[EMAIL PROTECTED] ~]$ ./test1 test1 131072
allocating 12, then 4096 byte structures 131072 times..
RSS: 536868
[EMAIL PROTECTED] ~]$ ./test1 test2 131072
allocating 4108 byte structure 131072 times..
RSS: 1059244

The source is available here:

http://www.creative.net.au/diffs/mem-size.c

I believe newer allocators do this sort of thing. Could people on other platforms
(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 ...

After some fix and code pasting from Squid sources, it seems to work.

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

Windows XP Professional x86 SP2 with 512 MB RAM
G:\mem-size\Release>memsize.exe test1 131072
allocating 12, then 4096 byte structures 131072 times..
RSS: 21230
G:\mem-size\Release>memsize.exe test2 131072
allocating 4108 byte structure 131072 times..
RSS: 5519

Windows XP Professional x86 SP2 with 1.5 GB RAM
C:\>\\voyager1\work\mem-size\Release\memsize.exe test1 131072
allocating 12, then 4096 byte structures 131072 times..
RSS: 132503
C:\>\\voyager1\work\mem-size\Release\memsize.exe test2 131072
allocating 4108 byte structure 131072 times..
RSS: 132249

Windows Server 2003 x86 SP2 1 GB RAM
C:\>\\voyager1\work\mem-size\Release\memsize.exe test1 131072
allocating 12, then 4096 byte structures 131072 times..
RSS: 132548
C:\>\\voyager1\work\mem-size\Release\memsize.exe test2 131072
allocating 4108 byte structure 131072 times..
RSS: 132300

Windows Server 2003 x64 SP2 6 GB RAM
C:\>\\voyager1\work\mem-size\Release\memsize.exe test1 131072
allocating 12, then 4096 byte structures 131072 times..
RSS: 132970
C:\>\\voyager1\work\mem-size\Release\memsize.exe test2 131072
allocating 4108 byte structure 131072 times..
RSS: 132715

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/

Reply via email to