Menu

#19 Memory leak

closed
None
5
2012-07-18
2006-12-21
No

Hi,

a lot of storage won't get freed after the zip operation.

I am using rubyzip (0.9.1) gem in Sourceforge project Piggy (tested with ruby 1.8.2 (2004-12-25) [i386-mswin32]).

Cheers
Sascha

Discussion

  • Technorama Ltd.

    Technorama Ltd. - 2007-02-27

    Logged In: YES
    user_id=554308
    Originator: NO

    Please provide source code to demonstrate the bug.

     
  • Nobody/Anonymous

    Logged In: NO

    The sourcecode for Piggy is availiable. Just unzip the gem.

     
  • Technorama Ltd.

    Technorama Ltd. - 2007-02-28

    Logged In: YES
    user_id=554308
    Originator: NO

    Rubyzip doesn't create any persistent objects when doing zip operations.

    I tested the piggy code in a loop. The memory use never goes above 9M which is normal since the GC is not invoked until 8M are malloc'd in ruby.

     
  • Nobody/Anonymous

    Logged In: NO

    Thank you for investigating. I've got a different behaviour.

    Piggy calls the GC seperate times. Normally the memory in use will reduce with any of the calls but the memory peak caused by the zip operation stays resident. At least on my machine with the reported versions.

    I've tested this with large numbers of jpg-files that had an average size above 2 MB. The resulting zip files where a lot greater than 9 MB but below 100 MB.

    Cheers
    Sascha

     
  • Technorama Ltd.

    Technorama Ltd. - 2007-03-01

    Logged In: YES
    user_id=554308
    Originator: NO

    It appears to be a bug in Piggy. Calling GC.start doesn't do anything if GC.disable was called first.

     
  • Nobody/Anonymous

    Logged In: NO

    I'll check, why there's still something like GC.disable in the Piggy code. I guess I took it from some FXRuby tutorial or example. Thanks for the hint.

    But nevertheless: Your analysis doesn't match my observations. In Piggy the zip operation is followed by some other memory consuming operations. The memory used by these later operations gets freed when I call GC.start. The memory used by Rubyzip doesn't get freed.

    This doesn't mean, it must be a bug in Rubyzip. But for me it still looks like there is something wrong.

    Cheers
    Sascha

     

Anonymous
Anonymous

Add attachments
Cancel