release memory calling HTMLs files

Member
Posts: 178
Joined: 2008.09
Post: #1
Hi every one !....
I have a UIView with 4 buttons, and every button call a file.HTML (4 html in total)
but in instrument, on activity monitor every time I press a button calling a HTML, the memory increases, and add 4 or 5 MB each time pressing.

when the app reach 37 MB (on activity monitor) then the app crash.

I just can press only 7 times any button, then the app crash.
my app is not cleaning (release) each HTML, how can I fix please.
how can I release memory ?

i have this code on each button....

Quote:- (IBAction)IBAc_ojo1: (id)sender {
if (webView != nil)
[webView release];
webView = [[UIWebView alloc] initWithFrame:[myHTML_ojo1 bounds]];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"head-mandiblev" ofType:@"html"];
NSString *html = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath] isDirectory:YES]];
[webView setScalesPageToFit:YES];
[myHTML_ojo1 addSubview:webView];


I realy, realy need any kind of help.
thanks a lot !

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #2
I'm not at my computer, but I assume addSubview retains the view. Do you remove the webView from its superview before adding the new one?
Quote this message in a reply
Member
Posts: 178
Joined: 2008.09
Post: #3
how should I remove a webView before call a new one please ?
thanks for your help !

and here is my small project to download
you can see the code.

http://www.1572-8.com/zzz-xcode-testing/...n-html.zip

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 178
Joined: 2008.09
Post: #4
maximile Wrote:I'm not at my computer, but I assume addSubview retains the view. Do you remove the webView from its superview before adding the new one?

i dont know how to do it, please could you show me how to do it ?
thansk a lot !

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  __fastcall calling convention on iPhone Dimka 3 4,749 Aug 21, 2010 03:35 PM
Last Post: OneSadCookie
  removeFromSuperview not calling dealloc of view - SOLVED BeyondCloister 5 13,674 Aug 11, 2010 01:18 PM
Last Post: BeyondCloister
  Calling Obj-C from C miq01 7 4,685 May 1, 2009 09:19 PM
Last Post: ThemsAllTook