Re: optimizing memory utilization
From: Istvan Albert (ialbert_at_mailblocks.com)
Date: 09/15/04
- Next message: Robert Brewer: "RE: comparing datetime with date"
- Previous message: Michael Foord: "HTTP - basic authentication example."
- In reply to: Wes Crucius: "Re: optimizing memory utilization"
- Next in thread: Jeremy Bowers: "Re: optimizing memory utilization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 15 Sep 2004 11:39:22 -0400
> can't believe that python requires memory 200% "overhead" to store my
> data as lists of lists.
And it almost certainly doesn't.
One one hand there could be a sizebale overhead when running
your program even when loading a single data line.
So don't extrapolate from a small datasets.
But what I believe happens to you is that you keep references
alive and you end up with data duplication.
For example if you do:
lines = file('whatever').readlines()
then you say for example:
stripped_lines = [ line.strip() for line in lines ]
you've just made your program use twice the memory
at that point of the code.
You may also inadvertently keep your 'lines' variable
in the scope of the full program then
you'll effectively end up with a lot more memory consumption
overall.
Check and plug all these holes.
Istvan.
- Next message: Robert Brewer: "RE: comparing datetime with date"
- Previous message: Michael Foord: "HTTP - basic authentication example."
- In reply to: Wes Crucius: "Re: optimizing memory utilization"
- Next in thread: Jeremy Bowers: "Re: optimizing memory utilization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|