memory-leaks

iPhone memory management Question

Hi , i m new to iPhone programming. i am very confused... plz help .. i have a list of questions. 1. - (void){ ClassOne *ob = [[ClassOne alloc] init]; // do i should use autorelease here ? self.O = ob; [ob release]; // is this correct ?? } or -(void)dealloc{ [O release]; // is this correct ?? } which one will release ob ?...

Another iPhone memory leak question!!

Hi. I have a simple example of what I don't understand about memory management on the iPhone: - (IBAction)AssignAndReleaseOne :(id)sender { for (int i=0;i<10;i++) { someString = [[NSString alloc] initWithString:@"String Assigned"]; } [someString release]; } - (IBAction)AssignAndReleaseTen :(id)sender { for (int i=0...

Is there a way to automatically have a #define reproduced in each source file

Hi, I'd like the following to appear in every source file in my Visual C++ 2005 solution: #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define new DEBUG_NEW Is there a way of doing this without manually copying it in? Compiler option? Cheers ...

How to detect Out Of Memory condition?

I have an application running on Websphere Application Server 6.0 and it crashes nearly every day because of Out-Of-Memory. From verbose GC is certain there are the memory leaks(many of them) Unfortunately the application is provided by external vendor and getting things fixed is slow & painful process. As part of the process I need to...

Cleaning up ODBC DSN in C# .NET

I am using C# and an OBDC DSN to connect to a Paradox database. I seem to be leaking memory if I open and close each connection. My code is basically: csb.Dsn = "DNSName"; OdbcConnection con = new OdbcConnection(csb.ConnectionString); con.Open(); OdbcCommand comm= new OdbcCommand("SELECT...

Understanding the Instrument for memory leak checking - iPhone

Above given images is of my application leaks. Here I want to understand that, in Extended Detail - you can see different colors like light green, light pink, light brown, light purple. What does each color indicates? Now the other confusion is "How to locate the code which is creating a memory leak?" Upto what limit of memory leak...

cfnetwork memory leaks in iPhone

I am getting following type of memory leak in my application - instruments checking. I have properly allocated & deallocated every object. However i am getting this type of memory leak. std::_Deque_base<__CFURLCacheNode*, std::allocator<__CFURLCacheNode*> >::_M_allocate_node() What is the reason behind generating these kind of leak? W...

Disposing a StringBuilder object

How does one effectively dispose a StringBuilder object? If an user generates multiple reports in a single sitting, my app ends up using a huge amount of memory. I've read in a few sites online that the follow may help: StringBuilder sb = new StringBuilder(1000000); // loop goes here adding lots of stuff to sb exampleObject.Text = sb...

Memory leak in xbap application

Hi, We are using many custom controls by inheriting form the WPFcontrols as the base and customizing it for our need. However, the memory used by these controls are not released, even after pages using the controls are closed, until the whole application is closed. As these application has to work for a whole day performance decrease...

Most Common Memory/Resource Leak Errors.

All good C++ programmers know how to avoid leaking memory (or resources like sockets): Always use smart pointers, i. e.: std::auto_ptr, boost::shared_ptr. Always be aware of ownership of object: who owns, who refers, who is responsible, etc. But, memory leaks still happen. Point most common issues when you discovered a memory leak i...

- (void) processImage:(char *)image; ---char* causes a memory leak?

Hello everyone, in my app I'm trying to process an YUV422 image from a webcam. but I'm getting a huge memory leak. below you can see a sample of simplified code of my app. if I disable the "(m1..." line in the function, there is no leak. (but the images are not being processed). I've tried locks, pools, etc but nothing changed. I'm rela...

iPhone Memory Leaks

If an application produces a lot of memory leaks, are they "just" an in-app problem or are they also in RAM after the termination of the application? So does the iPhone OS release the memory allocated for the sandboxed application? Thank you ...

Objective C NSCFString Leaks with NSMutableArrays

I am cleaning up my code in a phonebook iPhone application and the Leaks tool in Instruments is reporting that I am leaking NSCFString objects. Here is the pattern that I am following: I have a Person class in my application that has nothing more than local NSString members and associated properties for first name, last name, etc. My ...

Memory report confusion shown by top and htop commands?

I'm on Slicehost 256 plan running one single Rails app on Ubuntu Hardy 64 bit server. This is the shot taken using top command sorted by memory% (Shift+M) And this is the screenshot taken while running htop command sorted by memory% used. The memory consumed by mysql using top shows 3.8% but the htop shows around 17 processes each e...

Python: Memory leak debugging

I have a small multithreaded script running in django and over time its starts using more and more memory. Leaving it for a full day eats about 6GB of RAM and I start to swap. Following http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks I see this as the most common types (with only 800M of memory used): (Pdb) objgraph....

Memory leak when calling java code from C using JNI

Hi, I have a C program that stores some object in java store using JNI. (Before someone ask, using java store is a requirment here and I have to write a client in C which would be able to add and retrieve objects from this store). I made the program and tried to add 100000 object of size 1KB. But after adding only 50000 objects I am get...

Red Gate Profiler equivalent for Objective-C Mac / iPhone

I love the profiling tools that Red Gate makes for when I write in C#. Right now I am writing an application for iPhone in Objective-C and I am having a hard time adjusting to Instruments. It's just not as easy to use. Does anybody have a better code profiler for memory and performance? If not, any good tutorials for instruments? Th...

What could a leaked UIImage of size 16 Bytes indicate?

16 Bytes is pretty small, right? None of the UIImages I create in my app are that small, yet the Leaks Instrument is reporting a leaked UIimage of size 16 Bytes... Any clues on what this could be? Incidentally, there was also a leaked CALayer object of 48 bytes... ...

NSURLConnection leak?

i have set up a nsurl which grabs the data from http. when i run instrument, it says i have a leak NSFNetwork object. and how do i release theConnection in (void)ButtonClicked? or it will be release later on? - (void)ButtonClicked { NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:KmlUrl] ...

Can dynamically loaded JavaScript be unloaded?

I am writing a web application that has a static outer "shell" and a dynamic content section. The dynamic content section has many updates as users navigate the system. When a new content block is loaded, it may also optionally load another JavaScript file. In the name of good housekeeping, I remove script blocks from the DOM that app...