473,467 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1807
> 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...
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:
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,...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.