Giter VIP home page Giter VIP logo

Comments (5)

TimCinel avatar TimCinel commented on June 13, 2024

There's a line
self.selfReference = nil
which is called when the ActionSheetPicker is dismissed.

If there are other references to self, then dealloc is called and no leaks occur.

Are you actually getting a leak? If so, how? I'm not able to produce a leak, and I get no analyser warnings.

One easy way to test is to place a breakpoint inside the dealloc method.

from actionsheetpicker.

uranpro avatar uranpro commented on June 13, 2024

sorry, i mean dealloc method will never calls.
UIView *v = [[[UIView alloc] init] autorelease];
[[[ActionSheetDatePicker alloc] initWithTarget:nil
successAction:nil
cancelAction:nil
origin:v] release];

from actionsheetpicker.

TimCinel avatar TimCinel commented on June 13, 2024

In your example, the ActionSheetTatePicker will deallocate after you call showActionSheetPicker and it is dismissed.

The selfReference is released and set to nil when the ActionSheetPicker is dismissed.

If the ActionSheetPicker is never dismissed (nor presented) then indeed, it won't be released. To avoid this situation, don't create one unless you intend on presenting it.

from actionsheetpicker.

TimCinel avatar TimCinel commented on June 13, 2024

UIView *v = [[[UIView alloc] init] autorelease]; ActionSheetDatePicker *datePicker = [[[ActionSheetDatePicker alloc] initWithTarget:nil successAction:nil cancelAction:nil origin:v]; [datePicker showActionSheetPicker]; [datePicker release];

In this case, the ActionSheetPicker will release soon after being dismissed. Set a breakpoint on the dealloc method for verification.

from actionsheetpicker.

uranpro avatar uranpro commented on June 13, 2024

I know.
You need to move line
self.selfReference = self;
to showInView: method

PS: In my example i do not call showAcionSheetPicker, because i want to show you memory leak

from actionsheetpicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.