2011-03-14 58 views
0

我正在爲我的應用程序使用JSON框架(SBJson)。重複使用sbjson框架時造成數千內存泄漏

通過

NSDictionary *results = [responseString JSONValue] ; 

解析值對於解析第一次在控制器與該代碼有沒有問題。當我再次調用相同的控制器時,會顯示數千個內存泄漏。

我經歷了許多論壇,但徒勞無功。任何人都可以告訴我我錯了什麼?

全碼:

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]; 

在此先感謝

問候, Sathish所在

Leaks in SBJSONValue

回答

0

嘗試解析它第二次之前釋放的對象。

[results release]; 
results = nil; 
+0

感謝您的快速答覆aurum,但我引入了nsdictionary並釋放和剔除它,但問題仍然存在。無論nsdictionary是否必須「保留」,或者它有「init」 – 2011-03-14 11:03:02