Re: python memory leak only in x86 64 linux

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rkmr.em@gmail.com

    Re: python memory leak only in x86 64 linux

    This is the code that is causing memory leak in 64 bit python [but not
    in 32 bit python].. is something wrong in the code?

    now = datetime.dateti me.now()
    oneday = datetime.timede lta(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(fiel dname):
    def comparedict(a,b ):
    return birthdaycompare (a[fieldname], b[fieldname])
    return comparedict

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

    f['birthday'] = birthday
    f['birthday_dt'] = birthday_dt
    new_f.append(f)
    new_f.sort(comp are_by('birthda y_dt'))

    On Tue, Apr 15, 2008 at 8:25 PM, rkmr.em@gmail.c om <rkmr.em@gmail. comwrote:
    the memory usage of a python app keeps growing in a x86 64 linux
    continuously, whereas in 32 bit linux this is not the case. Python
    version in both 32 bit and 64 bit linux - 2.6.24.4-64.fc8
    Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)
    >
    i isolated the memory leak problem to a function that uses datetime
    module extensively. i use datetime.dateti me.strptime,
    datetime.timede lta, datetime.dateti me.now methods...
    >
    i tried to get some info with guppy and the code goes like this
    >
    while True:
    print heapy.heap().ge t_rp()
    print heapy.setref()
    users = globalstuff.q.g et()
    for u in users:
    doalert(u)
    >
    >
Working...