Fwd: Memory leak in python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Abhishek S

    Fwd: Memory leak in python

    Hi Nick,

    Thanks for reply... Please include me in reply.
    Currently i am not in the list (i will subscribe soon)

    I upgarded to 2.4.1 - still the same issue.

    Nick>
    Thats not a lot of leak - have you done that over a
    longer time period?

    Abhi>
    I have tried for 4 days. It has reached 150MB.

    Nick>
    Are there any objects in gc.garbage?[color=blue][color=green][color=darkred]
    >>> gc.set_debug(gc .DEBUG_LEAK)
    >>> gc.get_debug( )[/color][/color][/color]
    62[color=blue][color=green][color=darkred]
    >>> gc.collect()[/color][/color][/color]
    0[color=blue][color=green][color=darkred]
    >>> gc.garbage[/color][/color][/color]
    [][color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]

    Abhi>
    There is none.

    Nick>
    Are you writing objects with __del__ methods? If so
    then that is your problem probably.

    Abhi>
    I have not written any __del__ methods.

    Nick>
    Have you written any C extension modules in C?

    Yes. Many - All of them are called only
    when the app starts. And never called again.
    Till then it is stable only - 16MB used.

    I have tried following - let me know if you need any
    more details.. and want me to try something.

    1)
    I found a "sizer" python program. Which gives me the
    module which is growing. It indicates that __main__ is
    growing.

    __main__': 4000774

    2) I tried following.. (not smart but..)

    def f():
    c = gc.get_objects( )
    j = 0
    for i in c:
    j = j + 1
    try:
    tmp = len(i)
    if tmp > 1000:
    print "(c[%d]) (%d)," % (j-1, tmp)
    except:
    pass

    it prints me as folows:

    l(c[175]) (7336),
    l(c[12475]) (1260),
    l(c[12477]) (1260),
    l(c[12479]) (1381),
    l(c[12481]) (1381),
    l(c[34159]) (1200),
    l(c[37144]) (28234),
    l(c[37191]) (28286),[color=blue][color=green][color=darkred]
    >>> type(c[37191])[/color][/color][/color]
    <type 'dict'>[color=blue][color=green][color=darkred]
    >>> for k,v in c[37164].items():[/color][/color][/color]
    .... print k, v
    .... b = b + 1
    .... if b > 30:
    .... break
    ....
    1085115764 620
    1080048556 2
    1085045932 4
    1085146316 1
    1085246700 2
    1090615060 9
    1089571940 2
    1090519084 2
    1090876932 234
    1093456364 48
    1085168140 2
    1089964748 6
    1089994828 0
    1090095684 69
    1076932268 2
    1085014108 6
    1080092204 10
    1084888812 1
    1118543628 48
    1089994860 6
    1076731524 6
    1079640188 3
    1084883076 15
    1079712492 1
    1118459244 64
    1080295564 1
    1076522028 4
    1085211788 2
    1076887700 20
    1076729756 70
    1091012236 2

    This two dict in the last is growing slowly..
    I am not maintaing any dict with such indices and
    value.

    Any clue?
    Please let me know what else to check and how!

    At the time i am ending this.. module size..
    '__main__': 7926830,

    Thanks,
    Abhishek

    Note: forwarded message attached.


    _______________ _______________ _______________ _____
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    Yahoo Mail: Your smarter, faster, free email solution. Organize your inbox, protect your privacy, and tackle tasks efficiently with AI-powered features and robust security tools.

Working...