base64 memory question
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

base64 memory question

From: Michele Petrazzo <michele.petrazzo@TOGLIunipex.it>
Date: Fri Mar 31 2006 - 18:56:46 CEST

Hi ng,
I see that after en encoding with base64, the memory used for the
variable that I use for store the encoded data, after deleted, python
keep a part of that memory:

#ls -lh on /tmp/test_zero
#-rw-r--r-- 1 michele michele 9,8M 2006-03-31 18:32 /tmp/test_zero

michele:~$ python2.4
Python 2.4.2 (#2, Nov 20 2005, 17:04:48)
[GCC 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import base64

# Now top say me:
6217 michele 15 0 4412 2536 3336 S 0.0 0.3 0:00.01 python2.4

>>> b = base64.encodestring(open("/tmp/test_zero", "rb").read())

#top:
6217 michele 15 0 39156 36m 3376 S 19.6 4.8 0:00.60 python2.4

>>> del base64, b

#top
6217 michele 15 0 25644 23m 3376 S 0.0 3.1 0:00.61 python2.4

So like I can read from the top, python "forgot" to free that part of
memory. Is this normal? Is there a solution for free that memory?

P.s. The same happen on my win2k machine with py 2.4.2

Thanks,
Michele
Received on Sun Apr 30 21:48:05 2006