Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in SBJsonStreamWriter #80

Closed
DinosaurDad opened this issue Jun 19, 2011 · 0 comments
Closed

Memory leak in SBJsonStreamWriter #80

DinosaurDad opened this issue Jun 19, 2011 · 0 comments
Labels
Milestone

Comments

@DinosaurDad
Copy link

In the current implementation of SBJsonStreamWriter, there is a leak that stems from the init method.

- (id)init {
    self = [super init];
    if (self) {
        maxDepth = 32u;
        stateStack = [[NSMutableArray alloc] initWithCapacity:maxDepth];
        state = [[SBJsonStreamWriterStateStart alloc] init];
    }
    return self;
}

The problem is the assignment of state to an alloc that never gets released (the property is assign, not retain). If I use state = [SBJsonStreamWriterStateStart sharedInstance]; instead, the leak goes away. With some fair amount of unit testing I haven't seen any side effect.

In light of issue #79, perhaps the fix for the __weak state property could address this as well?

@stig stig closed this as completed in 064d37d Jun 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants