Memory testing in Python

C

csselo

Hi all

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

thanks.
 
C

Cameron Laird

Hi all

I want to test my python code for memory efficiency in gnu/linux.How
can I do this?
.
.
.
What does "memory efficiency" mean to you? Are you asking
how to eliminate memory leaks?

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."
 
M

mkPyVS

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.
 
C

Cameron Laird

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top