Is pickle buggy?

Thomas Thiele thiele at muc.das-werk.de
Tue Jul 11 07:35:54 EDT 2000


Hallo! I try it again, becouse it is important:

Why doesn't this programm (pickle) eats memory?
Why does pickle (marshal in it) not freeing the whole memory?

And not cPickle eats more memory!

#-------------------------------------------------------

import pickle, sys

stt = ""

one , two, three , four, five = 65,65,65,65,65

while(1):
		
	#only for creating differnet strings of constant size
	#in my real program the picke data are sent via socket
	stt = "%c%c%c%c%c" % (one, two, three , four, five)   
	one = one + 1
	if one > 90:
		one = 65
		two = two + 1
		if two > 90:
			two = 65
			three = three + 1
			if three > 90:
				three = 65
				four = four + 1	
				if four > 90:
					four = 65
					five = five + 1	
					if five > 65:
						one , two, three , four, five = 65,65,65,65,65
		
	x = X(stt) 

	file = open("testpickle.pkl", 'w')   
    	p = pickle.Pickler(file) 
	p.dump(x)
	file.close()
	
	file = open("testpickle.pkl", 'r')
    	up = pickle.Unpickler(file) 
	x1 = up.load() 
	file.close()

	print stt, sys.getrefcount(x1.s)

#-----------------------------------------------------------------------------------------------------
run this program for some hours and you'll get a memory overflow!


Now I began to hate python and its memory management! 
I want my "new" and "delete" back! ;-)
What are the advantages of pythons memory management, when it could not
be fixed if a real problem was happend?



More information about the Python-list mailing list