memory-leaks

Memory management in ipad/iphone app

I have an app where it seems to me that memory is not being release but I am not sure how to analyze this problem. 'Analyze' in xcode shows no problems and 'Instruments' does not show any memory leaks. As far as I have seen, it is not recommended to look at the retain counts. How can I find the problematic objects? I have added printo...

Make process crash on large memory allocation

I'm trying to find a significant memory leak (15MB at a time, but doing allocations like this on multiple places). I checked the most obvious places, and then used AQTime, but I still can't pinpoint it. Now I see 2 options left: 1) Use SetProcessWorkingSetSize: I've tried this but my process happily keeps on running when using up more t...

C++ private pointer "leaking"?

I'm going to create a class to hold a long list of parameters that will be passed to a function. Let's use this shorter example: class ParamList{ public: ParamList(string& a_string); string& getString(); //returns my_string private: string& my_string; } My question is this: my_string is private, yet I'm returning the ref...

Unbinding presenters necessary in GWT

I'm using the MVP pattern from my GWT application following the example given here http://code.google.com/webtoolkit/doc/latest/tutorial/mvp-architecture.html I have a single MainPresenter and sub-presenter for each of the panels in the MainView. To show a new sub-presenter, I do something like this: presenter = new PresenterA(new Vie...

Dynamically allocated structure and casting.

Let's say I have a first structure like this: typedef struct { int ivalue; char cvalue; } Foo; And a second one: typedef struct { int ivalue; char cvalue; unsigned char some_data_block[0xFF]; } Bar; Now let's say I do the following: Foo *pfoo; Bar *pbar; pbar = new Bar; pfoo = (Foo *)pbar; delete pfoo; ...

javascript addEventListener memory-leaks question

If I use addEventListener to register an event on an element, then delete the element without removing the event and I did this repeatedly could I create a memory leak ? ...

ajax has got memory leak?

ajax tutorial on w3school at http://www.w3schools.com/ajax/ajax_database.asp In this function (function GetXmlHttpObject()), it creates a object: new XMLHttpRequest(); or new ActiveXObject("Microsoft.XMLHTTP"); but it doesn't delete this object after getting respons from server. Are there memory leaks ? ...

How to find the leaky faucet that loads into Malloc 32kb

I have been messing around with Leaks trying to find which function is not being deallocated (I am still new to this) and could really use some experienced insight. I have this bit of code that seems to be the culprit. Every time I press the button that calls this code, 32kb of memory is additionally allocated to memory and when the bu...

High memory usage for dummies

I've just restarted my firefox web browser again because it started stuttering and slowing down. This happens every other day due to (my understanding) of excessive memory usage. I've noticed it takes 40M when it starts and then, by the time I notice slow down, it goes to 1G and my machine has nothing more to offer unless I close other ...

NSString potential leak

Hello. When I build and analyze my project on XCode, I obtain a 'warning' on the following line: NSString *contactEmail = (NSString *)ABMultiValueCopyValueAtIndex(emailInfo, 0); The message is: Potential leak on object allocated on line ... and stored into contactEmail. Is there any error on that line? UPDATE I get the same 'warni...

Iphone memory leak with malloc

Hello. I have memory leak, found by instruments and it is supposed to be in this line of code: indices = malloc( sizeof(indices[0]) * totalQuads * 6); This is actually a code snippet from a tutorial, something which i think is leak-free so to say. Now I reckon, the error is somewhere else, but I do not know, where. These are the la...

Iphone - UITextView Memory-leak

I have a memory leak when i use a UITextView but I don't understand why : UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 160, 280, 150)]; textView.text = @"Hello World"; textView.editable = FALSE; [self.view addSubview:textView]; [textView release]; Is someone could help me? :S ...

uiwebview memory leaks

i am getting following memory leaks for webview initWebUILocalStorageSupport MobileQuickLookLibrary() and here is my code, i dont know what i am missing. NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0f]; [theRequest setHTTPMethod:@...

Why doesn't free(p) set p to NULL?

Any reasons why this can not be standard behavior of free()? multiple pointers pointing to the same object: #include <stdlib.h> #include <stdio.h> void safefree(void* p = NULL; } int main() { int *p = (int *)malloc(sizeof(int)); *p=1234; int* printf("p=%p p2=%p\n", p, p2); safefree((void* printf("p=%p p2=%p\n"...

Memory leaks detected using type char pointers in std::list

why i'm getting the memory leak errors without allocating or adding any elements to list below. should i just ignore it? #define CRTDBG_MAP_ALLOC #include <crtdbg.h> #include <list> using std::list; int main() { list <char*> roots; _CrtDumpMemoryLeaks(); } ...

[Obj-C/Cocoa] NSURLConnection leak issues

As a disclaimer I'd like to state that I'm fairly new to Objective-C and Cocoa. Currently I'm trying to write a basic application that can POST XML data to a particular endpoint. To achieve this, I've created a ServiceRouter class which uses NSURLConnection to post XML data to a particular URL. The ServiceRouter class is intended as a ...

NSXMLParser & memory leaks

Hi, I am parsing an XML file using a custom class that instanciates & uses NSXMLParser. On the first call everything is fine but on the second, third and later calls Instruments show tens of memory leaks on certain lines inside didEndElement, didEndElement and foundCharacters functions. I googled it and found some people having this i...

iPhone: Memory leak when using NSOperationQueue...

Hi, I'm sitting here for at least half an hour to find a memory leak in my code. I just replaced an synchronous call to a (touch) method with an asynchronous one using NSOperationQueue. The Leak Inspector reports a memory leak after I did the change to the code. What's wrong with the version using NSOperationQueue? Version without a M...

iphone - memory leaks in separate thread

I create a second thread to call a method that downloads several images using: [NSThread detachNewThreadSelector:@selector(downloadImages) toTarget:self withObject:nil]; It works fine but I get a long list of leaks in the log similar to: 2010-04-18 00:48:12.287 FS Companion[11074:650f] * _NSAutoreleaseNoPool(): Object 0xbec2640 of cl...

Is it safe to override `release` for debugging?

Sometimes I need to find out if an object will really be released. I could use Instruments of course, but that takes much time, and I have to search into millions of objects, so I used to do this: -(void)release { NSLog(@"I'm released"); [super release]; } But the problem is: is this safe to do? Can I get any problems when I o...