memory-leaks

Android: removing/destroying objects when screen is rotated

I am finding that performance degrades after one or more screen rotations, and I presume that this is likely to be because an App's main Activity is destroyed and recreated each time the screen is rotated and that my app must be leaking memory when that happens. I have read that, contrary to what one might expect, not all the objects cr...

Static function-scoped pointers and memory leaks

Hi all, I've written a simple library file with a function for reading lines from a file of any size. The function is called by passing in a stack-allocated buffer and size, but if the line is too big, a special heap-allocated buffer is initialized and used to pass back a larger line. This heap-allocated buffer is function-scoped and d...

memory leaks appearing after multiple loading

Hi everyone I have an, at least to me, strange case here: I have a relatively simple program which loads an XML file from the web, parses it and write the data into an array of dictionaries. Each dictionary represents a row in the table. The program works fine and if I attach my simulator to instruments and load the list, there is no me...

Perhaps a resource not released? What could cause this?

I'm working on a project and I came to a point where the following stack trace popped up: #0 0x0017c30c in _IO_flush_all_lockp () from /lib/libc.so.6 #1 0x0017d030 in _IO_cleanup () from /lib/libc.so.6 #2 0x0013e042 in exit () from /lib/libc.so.6 #3 0x00126bbe in __libc_start_main () from /lib/libc.so.6 #4 0x08049d11 in _start () ...

Memory Leak In C# Windows Service For Sending Emails

This seems to be a pretty popular problem/question these days but I cannot seem to find a solution to the problem. I have created a simple windows service in c# for sending out emails. The app works great except for it's memory usage. The front end of the app is web based and the service is queued by a text file being created in a direc...

How to profile and and get Javascript performance

I have a few scripts that use jQuery, and I think I have a memory leak in one of them. How one could profile and find what parts of the scripts that I have are using the most memory/CPU? Thanks ...

Why are memory leaks common?

Is it due to basic misunderstandings of how memory is dynamically allocated and deallocated on the programmer's part? Is it due to complacency? ...

Valgrind claims there is unfreed memory. Is this bad?

Valgrind gives me the following leak summary on my code. However, I have freed all malloc'ed memory. Is this a bad thing, or is this normal? My program is in c. ==3513== LEAK SUMMARY: ==3513== definitely lost: 0 bytes in 0 blocks. ==3513== possibly lost: 0 bytes in 0 blocks. ==3513== still reachable: 568 ...

How to detect where my app collapsed in linux

HI, i am recently in a project in linux written in C. This app has several processes and they share a block of shared memory...When the app run for about several hrs, a process collapsed without any footprints so it's very diffficult to know what the problem was or where i can start to review the codes.... well, it could be memory overfl...

How to use _CrtDumpMemoryLeaks()

I am trying to use _CrtDumpMemoryLeaks() to display memory leaks in my programs. But it does not display anything except for returning 0 in case of no memory leaks and 1 in case there is a leak. The link here shows the output should be like: Detected memory leaks! Dumping objects -> D:\VisualC++\CodeGuru\MemoryLeak\MemoryLeak.cpp(67) ...

ajax memory leak

I am experiencing a slow memory leak in both IE and Firefox using a combination of ASP.NET AJAX and jQuery. My scenario is very similar to the one described here : http://stackoverflow.com/questions/276087/preventing-ajax-memory-leaks except using jquery and asp.net AJAX, not protyotype: I have a webpage displaying data in an UpdatePane...

Memory leaks in Debug mode

Is there any reason for a program to leak when compiled in Debug mode and not in release? (Debug means debug informations, and compiler optimization disabled, Release means no debug info / full optimization) That's what it seems to do but I can't figure out why. Btw purify is not being helpful here ...

refreshing singleton object data in object c

here is code + (SalesCollection*)sharedCollection { @synchronized(self) { if (sharedInstance == nil) { [[self alloc] init]; // assignment not done here } } return sharedInstance; } + (id)allocWithZone:(NSZone *)zone { @synchronized(self) { if (sharedInstance == nil) { sharedInstance = [super allocWithZone:z...

jQuery load() method memory leak?

I have hunted around for answer to this one, and though have found related quesions, I couldn't quite find an exact match for this. I have a fairly large app which is supposed to load pages into divs in another page using the jQuery.load() method. The problem I have is that when loading the same page over and over again into the same d...

Efficiently counting the number of lines of a text file. (200mb+)

Hello all, I have just found out that my script gives me a fatal error: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 440 bytes) in C:\process_txt.php on line 109 That line is this: $lines = count(file($path)) - 1; So I think it is having difficulty loading the file into memeory and counting the ...

Unmanaged leak in a trivial WPF application

I've run into a situation where I'm leaking unmanaged memory when the mouse is moved over my WPF app. Specifically, when I profile the application in perfmon or Red Gate's memory profiler, the private bytes monotonically increase, but the bytes in all managed heaps stay constant -- which, I believe, means that the app has an unmanaged l...

NSArray NSString memory leak

Hello all, I have a simple method to read a string and parse it to an array, -(NSArray *) readFileToArray: (NSString *)file{ NSString *values = [NSString stringWithContentsOfFile: file]; NSArray *tokens = [values componentsSeparatedByString:@":"]; return tokens; } however instruments did report me I got a leak on NSString at line...

Objective-C memory management strange results

I am calling a function repeatedly with a loop, and the loop runs inside of a thread. The thread has an autorelease pool. I have the following code inside that function: NSXMLDocument* undoXML; NSData* undoData = [NSData dataWithContentsOfFile:undoFilePath]; undoXML = [[NSXMLDocument alloc] initWithData:undoData opti...

XMLParser delegate and memory leaks

Hi everyone I am building an application that has to handle the parsing of several different kinds of XML files. As I want to standardize the procedure as much as possible, I created a singleton class which handles the parsing of any XML data. The class is handed two options, a unique identifier telling it what kind of XML data it is go...

Where is memory leak in this small function

Instruments says I have leak in this function. I am new to Obj-C so pardon for missing something obvious besides I am not sure if I am doing everything right here. (void) selectList:sender { NSMutableString *nibName = @"myController"; MyOwnController *study = [[MyOwnController alloc] initWithNibName:nibName bundle:nil]; study.title = @"...