[SunHELP] RE: memory leak under Solaris 7
OFrayman
OFrayman at VerticalAlliance.com
Tue Mar 12 12:52:37 CST 2002
> The amount of memory you should see is 1/64 th of the amount you
> have. Here is the article that explains everything that was sent to me
> directly from SUN. Hope this helps.
>
> Here is the article written by the Guru of Performance at SUN
> he wrote the book Sun performance and tuning and descibes what is
> happen to your memory
> While the aticle is from 1995 it is still valid today.Is this what
> you need?
>
> SunOS and Solaris handle your precious RAM. October 1995
>
> Abstract
>
> Why doesn't Sun's OS free unused memory? Adrian Cockcroft
> tackles this question in the first of his
> monthly performance columns for SunWorld Online. Cockcroft,
> Sun's performance guru, has heard and
> answered this and countless other questions during his years as
> a systems engineer. Once he explains how
> Solaris 1 and 2 handle your computer's memory, you'll probably
> be relieved. (2,600 words)
>
>
>
> Dear Adrian,
> After a reboot I saw that most of my computer's memory was free, but
> when I launched my application
> it used up almost all the memory. When I stopped the application the
> memory didn't come back! Take a
> look at my vmstat output:
>
> % vmstat 5
> procs memory page disk faults
> cpu
> r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy
> cs us sy id
>
> This is before the program starts:
>
> 0 0 0 330252 80708 0 2 0 0 0 0 0 0 0 0 1 18 107
> 113 0 1 99
> 0 0 0 330252 80708 0 0 0 0 0 0 0 0 0 0 0 14 87
> 78 0 0 99
>
> I start the program and it runs like this for a while:
>
> 0 0 0 314204 8824 0 0 0 0 0 0 0 0 0 0 0 414 132
> 79 24 1 74
> 0 0 0 314204 8824 0 0 0 0 0 0 0 0 0 0 0 411 99
> 66 25 1 74
>
> I stop it, then almost all the swap space comes back, but the free
> memory does not:
>
> 0 0 0 326776 21260 0 3 0 0 0 0 0 0 1 0 0 420 116
> 82 4 2 95
> 0 0 0 329924 24396 0 0 0 0 0 0 0 0 0 0 0 414 82
> 77 0 0 100
> 0 0 0 329924 24396 0 0 0 0 0 0 0 0 2 0 1 430 90
> 84 0 1 99
>
> I checked that there were no application processes running. It looks
> like a huge memory leak in the operating
> system. How can I get my memory back?
> --RAMless in Ripon
>
> The short answer
> Launch your application again. Notice that it starts up more quickly
> than it did the first time, and with less disk
> activity. The application code and its data files are still in
> memory, even though they are not active. The memory
> they occupy is not "free." If you restart the same application it
> finds the pages that are already in memory. The
> pages are attached to the inode cache entries for the files. If you
> start a different application, and there is
> insufficient free memory, the kernel will scan for pages that have
> not been touched for a long time, and "free" them.
> Once you quit the first application, the memory it occupies is not
> being touched, so it will be freed quickly for use
> by other applications.
>
> In 1988, Sun introduced this feature in SunOS 4.0. It still applies
> to all versions of Solaris 1 and 2. The kernel is
> trying to avoid disk reads by caching as many files as possible in
> memory. Attaching to a page in memory is around
> 1,000 times faster than reading it in from disk. The kernel figures
> that you paid good money for all of that RAM, so
> it will try to make good use of it by retaining files you might
> need.
>
> By contrast, Memory leaks appear as a shortage of swap space after
> the misbehaving program runs for a while. You
> will probably find a process that has a larger than expected size.
> You should restart the program to free up the
> swap space, and check it with a debugger that offers a leak-finding
> feature (SunSoft's DevPro debugger, for
> example).
>
>
>
> Oleg Frayman
> Sun Certified System Administrator
> 190 W. Germantown Pike, Suite 210
> Norristown , PA. 19401-1385
> Phone: 610-278-1838 x147 Fax 610-278-6638
> mailto:ofrayman at verticalalliance.com
> "Customer Interaction & Ticketing Solutions
> for the Sports, Media & Entertainment Industries"
> See us at:
> NHL Club Marketing Meetings in Dallas - March 13 & 14
More information about the SunHELP
mailing list