memory-leaks

UIDatePickerModeDateAndTime leaks

After a bit of time searching and commenting out my code, I've discovered that UIDatePickerModeDateAndTime leaks while UIDatePickerModeDate doesn't - however, I need to be able to set date and time via a picker so I need ...DateAndTime. What's odd is that any other problem that I've encountered, I've Googled it and usually found referen...

GetOracleDecimal Memory Leak

@GilShalit posted this comment a year ago: "Well, we have come to distrust ODP (.Net 2.0) after fighting a memory leak (in code we supplied to a customer) in GetOracleDecimal for over a year... Good luck!" – GilShalit Aug 27 '09 at 12:44 How did you solve it? We have a service that queries an Oracle database every few mi...

I've "fixed" a memory leak, but.. how to fix it in a better way?

It was a very fast and makeshift, bug fix.. It worked, but I would like to find a better understanding and solution. This was the Class Constructor generating the leak final transient DataInputStream din; final transient DataOutputStream dout; final transient BufferedReader bin; final transient BufferedWriter bout; NData(Socket s...

How to determine if an ASP.NET site has a memory leak

Without using any third-party tools, how can you determine if an ASP.NET application (.NET 3.5) has any memory leaks? I want to make sure that an app that was developed by someone else is running okay. I would assume using performance counters but which one(s) are the right ones to use to see if the app has memory leaks? ...

How to remove references to HttpWebRequests when making calls to webservice that don't return any response?

Hi, When making calls to a webservice from an asp.net web application, to avoid creating a new proxy for each webservice call, I store the proxy in a dictonary. So when a call to the webservice is being made, an instance of the webservice proxy is returned based on a key passed to a factory method. If a proxy for the corresponding key i...

What is the best method for memory cleanup in PHP? (5.2)

Hi, I have two simple questions. What is better/useful for memory cleanup. $var = null; or unset($var); I have one function with one cycle. I am getting (after few minutes) Fatal error: Allowed memory size of 419430400 bytes exhausted I am setting null and unset()-ing every object (at the end of the cycle) but still without any...

CALayer causes memory leaks?

Hello, the following code makes my app slower as a snail (it causes a memory leak i think): CALayer *layer = [[CALayer layer] retain]; detailcell.layer.borderColor = [UIColor grayColor].CGColor; detailcell.layer.borderWidth = 2; detailcell.layer.shadowColor = [UIColor blackColor].CGColor; detailcell.layer.shadowOpacity = 1.0; detailce...

Memory leak when spliting sentences with strtok

I'm trying to split a string into sentences (delimited by sentence delimiters). The code itself it working but I keep getting memory leaks in the function. char ** splitSentences(char *string) { int sentencecount = 0; char* buf = NULL; char* str = NULL; buf = malloc((strlen(string) + 1) * sizeof(char)); strcpy(buf,string); str = buf...

memory leak in HTML::TreeBuilder

I have some Perl code: use HTML::Parse; use HTML::FormatText; # ... my $txtFormatter = HTML::FormatText->new(); while ( ... ) { # some condition my $txt = # get from a file my $html_tree = HTML::TreeBuilder->new_from_content($txt); $txt = $txtFormatter->format($html_tree); $html_tree->delete(); # write $txt to a...

How to free memory after an Ajax request

Hello, I have a very basic ajax slideshow on my website. On every scroll, the new images and response content continually increase the amount of memory used by the browser. I've done my research and tried all suggestions to reset the XHR object on each new request, but this does absolutely nothing to help. The slideshows are basic bu...

C Programming - Return Pointer to Freed

I have a function, foo(), that allocates memory and returns it. Is it standard practice for me to free it at the end of my main function? char* foo(){ char * p; p = malloc(sizeof(char) * 4); /* edit - thanks to msg board */ p[0] = 'a'; p[1] = 'b'; p[2] = 'c'; p[3] = '/0'; /* edit: thanks to the msg board. */ return p; } int ma...

[C++] memory leak with std::string when using std::list<std::string>?

I'm working with std::list in my current project. But there is a memory leak somewhere connected with this. So I've tested the problematic code separately: #include <iostream> #include <string> #include <list> class Line { public: Line(); ~Line(); std::string* mString; }; Line::Line() { mString = new std::string("XXXXX...

iphone instruments tells about memory leak in NSMutableArray *bookDicts = [NSMutableArray arrayWithContentsOfFile:documentsDirectory];

Hi Can anyone tell me what I am doing wrong in the following few lines? NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString *documentsDirectory = [paths objectAtIndex:0]; documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"Immobilien.plist"]; ...

How do I know I have leak in Java?

I'm running my application using the Netbeans profiler and the char type seem very active. I see the generations number reaching all the way up to 180 generations and dropping down to 80 and going back up it seems to average 160 generations. It's hard to tell because it is a custom TCP/IP server app that uses JDBC, Hibernate and connect...

memory leak - C++

I need some help to find a memory leak in my C++ code. I try to put these lines in my constructor but it causes a memory leak because of lines 2 and 3 in the constructor: Myclass::Myclass() { ACE_Time_Value tm = ACE_OS::gettimeofday(); m_obj.firstStr() = tm.sec(); m_obj.secondStr() = tm.usec(); } Here, firstStr() and secondStr(...

Need help fixing iPhone memory leaks!

I encountered some strange memory leaks executing following code on iPhone device: @implementation TestViewController @synthesize myButton; - (IBAction)buttonPressed { ABPeoplePickerNavigationController* selectContactViewController = nil; selectContactViewController = [[ABPeoplePickerNavigationController alloc] init]; sel...

Class instance sizes in Android

Hi guys, I'm currently implementing some image processing code for Android. I'm aware of the memory limits and am happy to code within them. However, I cannot find any documentation that lets me work out how many bytes are used for each instance of a given class that I might want to instantiate (on the heap). I'm an experienced C++ pro...

will Ptheard kill free dynamic memory allocated in the thread function?

Hi All, I have a thread function which allocates memory using malloc(). I kill the thread using pthread_kill without freeing the dynamically allocated memory.Will it be freed automatically once i call pthread_kill or there will be a leak? ...

Iphone substring causing memory leak

Hi All, Im just wrapping up my app, so im onto the stage of running instruments to identify leaks in the app. Ive come across a leak that I cannot work out why it is being registered as a leak. I have the following lines for example: NSString *imageType = [[[NSString alloc] initWithString:[loopString substringToIndex:[loopString rangeO...

Bitmap OutOfMemory on Multiple Screen Changes

I have a bitmap that I load from the SD card by allowing the user to choose a picture to display. Once the bitmap is created, I set the Bitmap in an ImageView: mBitmap = Bitmap.createBitmap(Media.getBitmap(this.getContentResolver(), mPictureUri)); mImageView.setImageBitmap(mBitmap); This works fine. But, if I change the screen orienta...