[PLUG] Getting the amount of free memory in C
Russell Senior
seniorr at aracnet.com
Thu Nov 7 22:20:25 UTC 2002
>>>>> "Felix" == Felix Lee <flee at aracnet.com> writes:
>> How about a call to tell me how much I've allocated?
Felix> getrusage()
Not sure that will work. According to the man page, "Not all fields
are meaningful under Linux. Right now (Linux 2.4) only the fields
ru_utime, ru_stime, ru_minflt, ru_majflt, and ru_nswap are
maintained." I haven't tested it. Also, even if the data is
maintained, it might be at too coarse a granularity. Seems the
interface reports in 1k blocks. It might be hard to see a memory leak
at that resolution, depending on the leak of course.
--
Russell Senior ``I've seen every kind of critter God ever made,
seniorr at aracnet.com and I ain't never seen a meaner, lower, more
stinkin' yellow hypocrite than you!''
-- Burl Ives as Rufus Hennessy
More information about the PLUG
mailing list