On Tue, Apr 22, 2008, Henrik Nordstrom wrote: > tis 2008-04-22 klockan 19:35 +0800 skrev Adrian Chadd: > > yeah, thats pretty invalid. :) I wonder if your method for returning > > RSS is valid. > > RSS is Resident Set Size, the number of in-core memory pages currently > occupied by the process. Not the process size, or even amount of used > memory for this process.
[snip] I know that. The "its invalid" was an indication of the value of the RSS number, not that the methodology wasn't sound. Of course, if you ran my test program on a box that didn't have enough physical RAM for the test then it wouldn't succeed. The reason I touched all the pages was to try and convince the OS that it wanted to map physical memory to those pages. Assuming everything else was equal (ie, stuff like the currently mapped in libc pages, enough RAM for the working set without hitting the pager pageout threshold, etc) then the difference should (mostly) be accountable to the malloc implementation. In any case, Guido's response of "its the number of pages!" explained the base discrepancy. The unfortunate issue here is that "pagesize" can be variable and one would need to find the system/process' pagesize (and hope its constant!) to multiply that number by to get an accurate result. Adrian -- - Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support - - $25/pm entry-level VPSes w/ capped bandwidth charges available in WA -
