[issue2652] 64 bit python memory leak usage

kevin report at bugs.python.org
Fri Apr 18 00:26:08 CEST 2008


New submission from kevin <kevin3210 at gmail.com>:

For the code below.. memory usage keeps increasing continuously.. This
does not happen in a 32-bit machine python build. i think it might be
the datetime module where the problem might be..


linux kernel version (both on 32-bit and 64 bit machine)
linux - 2.6.24.4-64.fc8
python version (both on 32-bit and 64 bit machine)
Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)


now = datetime.datetime.now()
oneday = datetime.timedelta(days=1)

def birthdaycompare(a, b):
   if a is None and b:
       return 1
   if a and b is None:
       return -1
   if a is None and b is None:
       return 0
   if a<b:
       return -1
   elif a==b:
       return 0
   else:
       return 1

def compare_by(fieldname):
   def comparedict(a,b):
       return birthdaycompare(a[fieldname], b[fieldname])
   return comparedict

def getbirthdays(friend_details):
   new_f = []
   birthday = None
   birthday_dt = None
   for f in friend_details:
       if f.has_key('birthday'):
           birthday = f['birthday']
       if birthday and birthday !='':
           birthday_split = birthday.split(',')[0]
           if birthday_split == 'February 29':
               birthday = 'February 28'
           try:
               birthday_dt =
datetime.datetime.strptime(birthday_split + ', ' + str(now.year) , '%B
%d, %Y')
               if birthday_dt < (now - oneday):
                   birthday_dt =
datetime.datetime.strptime(birthday_split + ', ' + str(now.year+1) ,
'%B %d, %Y')
           except:
               birthday=None
               birthday_dt=None

       f['birthday'] = birthday
       f['birthday_dt'] = birthday_dt
       new_f.append(f)
   new_f.sort(compare_by('birthday_dt'))

----------
files: data.log
messages: 65596
nosy: kevin3210
severity: normal
status: open
title: 64 bit python  memory leak usage
type: resource usage
versions: Python 2.5
Added file: http://bugs.python.org/file10051/data.log

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2652>
__________________________________


More information about the Python-bugs-list mailing list