Found Several Memory Leaks
Opened this issue · 2 comments
John-Lluch commented
I found several leaks that prevent the library to work on large databases due to memory warnings and ultimate crash.
In BuildQueryOption of DataServiceQuery you have
NSMutableString *query=[[NSMutableString alloc] init]; // leak
you should have:
NSMutableString *query=[[[NSMutableString alloc] init] autorelease]; // ok
in initWithUrl of HttpRequest you have:
self.m_httpHeaders = [[HTTPHeaders alloc] initWithHeaders:aHeader] ; // leak
you should have:
m_httpHeaders = [[HTTPHeaders alloc] initWithHeaders:aHeader] ; // ok
in initWithUrl of objectContext you have:
self.m_entities = [[NSMutableArray alloc]init]; // leak
self.m_objectToResource = [[Dictionary alloc] init]; // leak
self.m_bindings = [[Dictionary alloc] init]; // leak
self.m_identityToResource = [[NSMutableDictionary alloc] init]; // leak
you should have:
m_entities = [[NSMutableArray alloc]init]; // ok
m_objectToResource = [[Dictionary alloc] init]; // ok
m_bindings = [[Dictionary alloc] init]; // ok
m_identityToResource = [[NSMutableDictionary alloc] init]; // ok
in init of XMLParser you have a tremendous leak !
self.xmlElements = [[NSMutableArray alloc] init]; // huge leak
you should correct it by:
xmlElements = [[NSMutableArray alloc] init]; // ok
I changed this manually in the version I am using and it now works flawlessly without any memory issues.
Please correct this.
Thanks !!
Joan Lluch-Zorrilla
arlobelshee commented
Yikes! Happy to fix. Can you send me a pull request with these changes?
arlobelshee commented
@Joan-Lluch Can you send me a pull request with your fixes? I'd love to integrate them.