Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Found Several Memory Leaks #10

Open
John-Lluch opened this issue May 31, 2012 · 2 comments
Open

Found Several Memory Leaks #10

John-Lluch opened this issue May 31, 2012 · 2 comments

Comments

@John-Lluch
Copy link

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
Copy link
Contributor

Yikes! Happy to fix. Can you send me a pull request with these changes?

@arlobelshee
Copy link
Contributor

@Joan-Lluch Can you send me a pull request with your fixes? I'd love to integrate them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants