473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

getrusage

When I call resource.getrusage on Linux, I don't get any memory stats:

Python 2.2.2 (#1, Jan 30 2003, 21:26:22)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from resource import getrusage,RUSAGE_SELF
print getrusage(RUSAGE_SELF) (0.019531, 0.0078119999999999995, 0, 0, 0, 0, 178, 387, 0, 0, 0, 0, 0, 0, 0, 0)


On AIX, I get the correct numbers.

What is the goal? I need to find a memory leak in an extension module.
For starters, I was going to find extension method calls that produce
unexpected memory use (and I found some on AIX - but our 12 year old AIX
system is *so* slow). Suggestions are welcome.
Jul 18 '05 #1
2 3823
Stuart D. Gathman wrote:
When I call resource.getrusage on Linux, I don't get any memory stats:

Python 2.2.2 (#1, Jan 30 2003, 21:26:22)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from resource import getrusage,RUSAGE_SELF
print getrusage(RUSAGE_SELF)

(0.019531, 0.0078119999999999995, 0, 0, 0, 0, 178, 387, 0, 0, 0, 0, 0, 0, 0, 0)

On AIX, I get the correct numbers.


On FreeBSD, you get correct numbers as well. The Linux kernel, however,
doesn't implement the RUSAGE field, even though it could easily be done
(I once had the same question as you, and did this research then).
What is the goal? I need to find a memory leak in an extension module.


Try compiling a debug version of Python with the option --with-debug and
you can debug refcount problems much better.

-- Gerhard

Jul 18 '05 #2
On Wed, 10 Sep 2003 19:49:36 -0400, Gerhard Häring wrote:
On FreeBSD, you get correct numbers as well. The Linux kernel, however,
doesn't implement the RUSAGE field, even though it could easily be done
(I once had the same question as you, and did this research then).
What is the goal? I need to find a memory leak in an extension module.


Try compiling a debug version of Python with the option --with-debug and
you can debug refcount problems much better.


The leak turned out to be in the C library wrapped by the extension
module. I debugged the C library with http://dmalloc.com

Very nice package.

--
Stuart D. Gathman <st****@bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matthias Oberlaender | last post by:
My problem is that cpu times returned by getrusage seem to be rounded to 10 ms units (so also does time.clock). I never noticed such a low resolution in previous versions. Since I have not found...
2
by: Frank | last post by:
Hi, I got a test script with thread. Pretty much the basic stuff. Each threat runs the same subroutine. At the beginning and end in the subroutine I call getrusage to get the usage. But I can...
4
by: JackyMove | last post by:
Dear all, I would like to get the time on how long to run a short segment of my c program in usec under Windows platform using dev-c++. Is there any method or function call to get it other than...
40
by: aku | last post by:
I'm looking for the absolute fastest way to count the nr of bits that are set to "1" in a string. Presumably I then first need the fastest way to do this in a byte. I think this is it, but...
7
by: sathyashrayan | last post by:
Group, Following function will check weather a bit is set in the given variouble x. int bit_count(long x) { int n = 0; /* ** The loop will execute once for each bit of x set,
35
by: Alex Martelli | last post by:
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is...
3
by: babis85 | last post by:
Hello guys, i have this part of code and i want to compute the time of processes A, B and C : /* process A */ pid_t pid1, pid2, pid; struct rusage ru1, ru2; pid1 = fork(); if (pid != 0) {/*...
14
by: Henning Hasemann | last post by:
Hi all, sounds trivial (I hope it is): Im searching for a way to get a time-value thats more exact than just seconds (i.e. I need milli- or microseconds or something similar, just at least as good...
74
by: aruna.mysore | last post by:
Hi all, I have a simple definitioin in a C file something like this. main() { char a; ....... int k; }
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.