473,400 Members | 2,145 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,400 software developers and data experts.

Memory testing in Python

Hi all

I want to test my python code for memory efficiency in gnu/linux.How
can I do this?

thanks.

Mar 30 '07 #1
3 1487
In article <11*********************@n59g2000hsh.googlegroups. com>,
<cs****@gmail.comwrote:
>Hi all

I want to test my python code for memory efficiency in gnu/linux.How
can I do this?
Mar 30 '07 #2
>While I have a great deal of interest in memory management,
>my general reaction to your question as you've posed it is,
"Don't; concentrate for now on good Python style."
I agree but for monitoring...

I've had good luck with executing a popen to grab and parse output
from ps -Af and pass it your own process ID as the search. It adds
overhead to the cpu exec time but it is much less than 1sec so you
won't see it.

Mar 30 '07 #3
In article <11**********************@l77g2000hsb.googlegroups .com>,
mkPyVS <mi*********@hotmail.comwrote:
>>While I have a great deal of interest in memory management,
my general reaction to your question as you've posed it is,
"Don't; concentrate for now on good Python style."

I agree but for monitoring...

I've had good luck with executing a popen to grab and parse output
from ps -Af and pass it your own process ID as the search. It adds
overhead to the cpu exec time but it is much less than 1sec so you
won't see it.
Fair enough.

Did you intend to suggest "ps -F"? While ps remains not-so-well
standardized, I know of no version where "ps -Af" details *memory*
usage.

Parsing can be simplified with such invocations as
ps -o pid -o rss -o size -o cmd
(which can itself be rewritten in various ways, depending on the
flavor of ps involved).
Mar 30 '07 #4

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

Similar topics

10
by: Steven D'Aprano | last post by:
Can somebody help me please? I've spent a fruitless hour googling with no luck. I'm discussing memory allocation techniques with somebody, and I'm trying to find a quote from -- I think -- Tim...
3
by: mensanator | last post by:
Since the following discussion took place (unresolved), ...
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...
0
by: Antonio Arauzo Azofra | last post by:
Hello everybody, Probably, this is being too demanding for Python, but it may be useful to unimport modules to work with dynamic code (though not the best, one example is ). In fact, it is...
0
by: Antonio Arauzo Azofra | last post by:
Hello everybody, Probably, this is being too demanding for Python, but it may be useful to unimport modules to work with dynamic code (though not the best, one example is ). In fact, it is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.