Python 2.7 memory profiler

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Python 2.7 memory profiler

David Crisp-3
Im trying to find a Python 2.7 memory profiler (for windows +64bit
python) all I can find are the 2.6 versions.

How do I find out how much physical memory an array is using in memory
other than doing the calculation of "well this is two bytes and I have
1000 of them that means 2000 bytes" ......

Regards,
David ps - have changed my mailignlist address to gmail
_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: Python 2.7 memory profiler

Tennessee Leeuwenburg-3
Hi David,

I'm not really sure, but I'd also like to know the answer if you find out!

Cheers,
-T

On Mon, Apr 18, 2011 at 11:49 AM, David Crisp <[hidden email]> wrote:
Im trying to find a Python 2.7 memory profiler (for windows +64bit
python) all I can find are the 2.6 versions.

How do I find out how much physical memory an array is using in memory
other than doing the calculation of "well this is two bytes and I have
1000 of them that means 2000 bytes" ......

Regards,
David ps - have changed my mailignlist address to gmail
_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug



--
--------------------------------------------------
Tennessee Leeuwenburg
http://myownhat.blogspot.com/
"Don't believe everything you think"

_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: Python 2.7 memory profiler

Ed Schofield-3
In reply to this post by David Crisp-3
Hi David,

On Mon, Apr 18, 2011 at 11:49 AM, David Crisp <[hidden email]> wrote:
Im trying to find a Python 2.7 memory profiler (for windows +64bit
python) all I can find are the 2.6 versions.


How do I find out how much physical memory an array is using in memory
other than doing the calculation of "well this is two bytes and I have
1000 of them that means 2000 bytes" ......
 
I don't know the answer to your first question, but if, by "array", you mean a NumPy array, you can use the nbytes property:

>>> a = numpy.arange(10**6).reshape(10**4, 10**2)
>>> a.nbytes
4000000

The answer is as you said (a.itemsize * a.size). The actual number of bytes will be a small fixed number of bytes more than the contents (because of the overhead of the ndarray pointers to dtype etc.), but this is usually negligible.

Cheers,


--
Dr. Edward Schofield
Python Charmers
+61 (0)405 676 229
http://pythoncharmers.com


_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: Python 2.7 memory profiler

Joe Healy-2
In reply to this post by David Crisp-3

There is Meliae. It may be of assistance.

https://launchpad.net/meliae

I think it crawls memory and then lets you analyse what is taking the
space. Haven't used it, but came across it from:

http://blog.vrplumber.com/index.php?/archives/2490-Meliae-is-neat,-but-scary....html

Although a closer reading may mean that you have a particular one in
mind, but just need a version compiled for 2.7. Is that the case?

If that is the case, the blogger at blog.vrplumber.com may be able to
help as I know he has used meliae and may have used it for 2.7.

Cheers,

Joe


On Mon, 2011-04-18 at 11:49 +1000, David Crisp wrote:

> Im trying to find a Python 2.7 memory profiler (for windows +64bit
> python) all I can find are the 2.6 versions.
>
> How do I find out how much physical memory an array is using in memory
> other than doing the calculation of "well this is two bytes and I have
> 1000 of them that means 2000 bytes" ......
>
> Regards,
> David ps - have changed my mailignlist address to gmail
> _______________________________________________
> melbourne-pug mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/melbourne-pug


_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug