Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11766 > unrolled thread
| Started by | Jack Bates <ms419@freezone.co.uk> |
|---|---|
| First post | 2011-08-18 08:08 -0700 |
| Last post | 2011-08-18 19:07 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
Measure the amount of memory used? Jack Bates <ms419@freezone.co.uk> - 2011-08-18 08:08 -0700
Re: Measure the amount of memory used? John Gordon <gordon@panix.com> - 2011-08-18 15:39 +0000
Re: Measure the amount of memory used? MrJean1 <mrjean1@gmail.com> - 2011-08-18 19:07 -0700
| From | Jack Bates <ms419@freezone.co.uk> |
|---|---|
| Date | 2011-08-18 08:08 -0700 |
| Subject | Measure the amount of memory used? |
| Message-ID | <mailman.166.1313680196.27778.python-list@python.org> |
I wrote a content filter for Postfix with Python, https://github.com/jablko/cookie It should get started once, and hopefully run for a long time - so I'm interested in how it uses memory: 1) How does the amount of memory used change as it runs? 2) How does the amount of memory used change as I continue to hack on it, and change the code? My naive thought was that I'd periodically append to a file, the virtual memory size from /proc/[pid]/stat and a timestamp. From this a could make a graph of the amount of memory used as my content filter runs, and I could compare two graphs to get a clue whether this amount changed as I continue to hack - but some Googling quickly revealed that measuring memory is actually quite complicated? Neither the virtual memory size nor the "resident set size" accurately measure the amount of memory used by a process Has anyone else measured the memory used by a Python program? How did you do it?
[toc] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2011-08-18 15:39 +0000 |
| Message-ID | <j2jboc$hve$1@reader1.panix.com> |
| In reply to | #11766 |
In <mailman.166.1313680196.27778.python-list@python.org> Jack Bates <ms419@freezone.co.uk> writes:
> 1) How does the amount of memory used change as it runs?
I've observed that the amount of memory consumed by a program will
stay constant or increase; it never decreases.
Or were you wanting to measure the rate of increase over time?
> Has anyone else measured the memory used by a Python program? How did
> you do it?
I generally use 'top' to do this for any program.
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
[toc] | [prev] | [next] | [standalone]
| From | MrJean1 <mrjean1@gmail.com> |
|---|---|
| Date | 2011-08-18 19:07 -0700 |
| Message-ID | <52d4c51b-e820-4676-9273-aeef1a5030e1@e20g2000prn.googlegroups.com> |
| In reply to | #11766 |
Take a look it this recipe (for Linux only): <http://code.activestate.com/recipes/286222/> /Jean On Aug 18, 8:08 am, Jack Bates <ms...@freezone.co.uk> wrote: > I wrote a content filter for Postfix with Python,https://github.com/jablko/cookie > > It should get started once, and hopefully run for a long time - so I'm > interested in how it uses memory: > > 1) How does the amount of memory used change as it runs? > > 2) How does the amount of memory used change as I continue to hack on > it, and change the code? > > My naive thought was that I'd periodically append to a file, the virtual > memory size from /proc/[pid]/stat and a timestamp. From this a could > make a graph of the amount of memory used as my content filter runs, and > I could compare two graphs to get a clue whether this amount changed as > I continue to hack > > - but some Googling quickly revealed that measuring memory is actually > quite complicated? Neither the virtual memory size nor the "resident set > size" accurately measure the amount of memory used by a process > > Has anyone else measured the memory used by a Python program? How did > you do it?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web