classification
Title: 64 bit python memory leak usage
Type: resource usage Stage:
Components: Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, gregory.p.smith, kevin3210, pitrou
Priority: normal Keywords:

Created on 2008-04-17 22:26 by kevin3210, last changed 2009-05-10 20:54 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
data.log kevin3210, 2008-04-17 22:26 guppy heap information for each iteration
Messages (3)
msg65596 - (view) Author: kevin (kevin3210) Date: 2008-04-17 22:26
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'))
msg65603 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-04-18 07:23
Please provide a "main" function to test with.
I tried to write one based on your code; but memory usage was stable
after a few seconds.
msg87544 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-10 20:54
Closing since no further information was given about the workload.
History
Date User Action Args
2009-05-10 20:54:39pitrousetstatus: open -> closed

nosy: + pitrou
messages: + msg87544

resolution: not a bug
2008-04-18 07:23:21amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg65603
2008-04-18 00:22:43gregory.p.smithsetnosy: + gregory.p.smith
2008-04-17 22:26:08kevin3210create