473,386 Members | 1,785 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,386 software developers and data experts.

Actual memory used by an object --- How to Determine?



Hello:

My apologies in advance for asking a
question that probably has been raised
numerous times already in this newsgroup.
My Google search did not lead me to an
answer I could use.

Is there a Python module I could use
to determine the actual amount of memory
used by a Python object, including the
memory used by any subobjects contained
therein?

Avi Kak (ka*@purdue.edu)
Jul 18 '05 #1
1 1803
> My apologies in advance for asking a
question that probably has been raised
numerous times already in this newsgroup.
My Google search did not lead me to an
answer I could use.

Is there a Python module I could use
to determine the actual amount of memory
used by a Python object, including the
memory used by any subobjects contained
therein?


Quick answer: No.

Long answer:
In *nix, there are various programs that tell you the amount of memory a
resident process is using, my personal favorite for process information
is ps. You may be able to query it with the proper string to find the
total amount of memory Python is using in total, which may or may not be
useful. There are utilities for windows that functionally mirror *nix
ps. Either could be run from within Python, to be processed with python
via:
a = os.popen('ps <args...>', 'r')
output = a.read()
a.close()

- Josiah
Jul 18 '05 #2

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

Similar topics

0
by: zooko | last post by:
Here some some functions I've used to analyze memory usage in the past. http://mnetproject.org/repos/pyutil/pyutil/memutil.py There may be bugs. If so, please fix them or at least report them....
9
by: Chris S. | last post by:
Is it possible to determine how much memory is allocated by an arbitrary Python object? There doesn't seem to be anything in the docs about this, but considering that Python manages memory...
2
by: Arthur M. | last post by:
Does anyone know of a way to pin point true memory utilization on a per object / allocation basis in dot net. The problem that i'm having is projecting the amount of memory that will be required...
9
by: CptDondo | last post by:
I am working on an embedded platform which has a block of battery-backed RAM. I need to store various types of data in this block of memory - for example, bitmapped data for control registers,...
62
by: ivan.leben | last post by:
How can I really delete a preloaded image from memory/disk cache? Let's say I preload an image by creating an Image object and setting its src attribute to desired URL: var img = new Image();...
10
by: goose | last post by:
Hello all I've written a wrapper for malloc and friends. Its available from http://www.lelanthran.com/downloads/os_mem/index.php The reason for doing writing this so that newbies can...
6
by: pauldepstein | last post by:
Could anyone explain (by giving a URL possibly) how to solve problems of the form "How much memory does the following piece of code take?" For example, consider the declaration/definition ...
14
by: Joe | last post by:
I'm trying to track down where objects are referenced because I want to clean up the memory when I'm done with them. I thought I found all references but it doesn't seem that way because calling...
3
by: crazy420fingers | last post by:
I'm running a python program that simulates a wireless network protocol for a certain number of "frames" (measure of time). I've observed the following: 1. The memory consumption of the program...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.