[Python-Dev] Does eval() leak? (original) (raw)
John Marshall John.Marshall at ec.gc.ca
Thu Feb 16 17:30:02 CET 2006
- Previous message: [Python-Dev] Rename str/unicode to text
- Next message: [Python-Dev] Does eval() leak?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
Should I expect the virtual memory allocation to go up if I do the following?
raw = open("data").read() while True: d = eval(raw)
I would have expected the memory allocated to the object referenced by d to be deallocated, garbage collected, and reallocated for the new eval(raw) results, assigned to d.
The file contains a large, SIMPLE (no self refs; all native python types/objects) dictionary (>300K).
While doing 'd = eval(raw)' in the python interpreter I am monitoring the VIRT column of top and it keeps increasing until I run out of memory.
When I use a safe_eval() from: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 I have no memory problems.
I see this under python 2.3.5 (fast and obvious).
Thanks, John
- Previous message: [Python-Dev] Rename str/unicode to text
- Next message: [Python-Dev] Does eval() leak?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]