Search code examples
memoryios4json-framework

Thousands of memory leaks when using sbjson framework on repeated usage


I am using JSON framework (SBJson) for my applicaition.

parsing the value by

NSDictionary *results = [responseString JSONValue] ;

For parsing first time in controller with this code has no problem. when i call again for same controller it shows thousands of memory leaks.

I went through many forums but in vain. can anybody please tell me what i went wrong?

Full Code:

NSString *response = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding];


    //NSDictionary *results =[[response JSONValue] retain] ;

    if (results) {
        [results release];
        results=nil;
    }


    results =[[response JSONValue] retain] ;
    [response release];

Thanks in advance

Regards, Sathish

Leaks in SBJSONValue


Solution

  • Try releasing the object before parsing it a second time.

    [results release];
    results = nil;