Re: mem_node memory usage in 2.x

From: Guido Serassio <guido.serassio@dont-contact.us>
Date: Tue, 22 Apr 2008 12:19:16 +0200

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.
>
>[adrian@sarah ~]$ ./test1 test1 131072
>allocating 12, then 4096 byte structures 131072 times..
>RSS: 536868
>[adrian@sarah ~]$ ./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: guido.serassio@acmeconsulting.it
WWW: http://www.acmeconsulting.it/
Received on Tue Apr 22 2008 - 12:37:05 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT