NSRare / NSGIF

🔮 iOS Library for converting videos to animated GIFs.
MIT License
923 stars 190 forks source link

How to release memory? #7

Closed qyzhaojinxi closed 8 years ago

qyzhaojinxi commented 8 years ago

Hi ,it really helps me a lot.But when I convert a lot times,it takes some memory.I can't free these memory.Can you help me?

sebyddd commented 8 years ago

The memory is released after the conversion is done. Can you elaborate your issue, please?

qyzhaojinxi commented 8 years ago

I called the method:

  [NSGIF optimalGIFfromURL:videoURL loopCount:0 fileName:[filename stringByDeletingPathExtension]  completion:^(NSURL *GifURL) {
        }];

in GCD

     dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

    dispatch_group_t group = dispatch_group_create();

    dispatch_group_async(group, queue, ^{

           //call the mothod here

});

      dispatch_group_notify(group, dispatch_get_main_queue(), ^{
      NSLog(@"finished");
    });

When I finish this task,the memory is not freed.Even if I pop this Viewcontroller.

sebyddd commented 8 years ago

No need to wrap it in an asynchronous block. The library already handles all power consuming task on a different thread.

Is the conversion finished when you are popping the controller?

qyzhaojinxi commented 8 years ago

Yes,the conversion is finished.The reason why I write like this is that there are other tasks in gcd group and I want to know when all tasks are finished.

melakamc commented 8 years ago

Yes. The memory seems not to be released once the conversion happens :/ crashes after a few conversions.

cassidyclawson commented 8 years ago

I can also confirm a memory leak. For me it adds about the same amount of memory as the size of the gif per conversion.

cassidyclawson commented 8 years ago

I posted a $100 bounty for a fix to this bug, available to anyone (including the original author). https://www.bountysource.com/issues/31041391-gif-conversion-creates-memory-leak

sebyddd commented 8 years ago

Follow #9.

qyzhaojinxi commented 8 years ago

ok

aiyub007 commented 8 years ago

Solve this bug please memory leak is big problem

sebyddd commented 8 years ago

@aiyub007 – I don't have the time to properly address this issue. Solving this would require a rebuild from scratch of the GIF instead of building it on top of selected frames from the video. If you need this fixed by any means, you can hire me to do that.