memory-leaks

flex/bison fixing memory leaks with unexpected tokens

I have a flex bison application. For a few of my tokens, I copy out the yytext from flex using strdup. This works great except when there is an error of an unexpected token. simple example flex.l: ... [a-zA-Z0-9]+ { lval.string = strdup(yytext); return IDENT }; [\{\}] { return yytext[0] }; ... and parse.y ... %destructor { ...

Reading in 738627 records via flat file gives memory exhaustion error

I am trying to read in a simple flat file, it has 738,627 records in it, a sample of the file looks like this: #export_dategenre_idapplication_idis_primary #primaryKey:genre_idapplication_id #dbTypes:BIGINTINTEGERINTEGERBOOLEAN #exportMode:FULL 127667880285760002817317350 127667880285760002818261461 127667880285760002825372301 127667880...

Not Calling NHibernate Session Close

I'm looking at some code that I know has a memory leak and I think I know why. however; I am curious about the bloody details. At the beginning of a request there is a call to session.OpenSession(); in order to get an ISession but at the end of the request there is no call session.Close(); and/or session.Dispose(); What objects are sta...

using static dictionary as cache may lead to leak problem ?

hello all, I have memory leak in the web application (servlet) that I am working on. I am suspicious of 1 cause and wanted to hear your ideas about it. I use hashmaps,hashsets etc. as DB (about 20MB data loaded). These maps,sets get reloaded once in every 10 min. There are huge amount of simultaneous requests. I read that, GC passes ob...

can we start a animation, stop it and reassign new animation array to animationImages?

please read the code in my viewcontroller -(void)StartAnimation { if (self.myimgarray == nil) { self.myimgarray = [NSMutableArray arrayWithCapacity:0]; } UIImage *img; for (int i=0; i<=17; i++) { img = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"a_expand_%d.png",i] ofType:...

Memory issue with Tableview cell and using a UIButton in the cell.accessoryView

I am adding a custom UIButton to the accessoryView of UITableViewCell. I pay strict attention to the retain count and have found that the retain count is incremented to 2 when I add the button but if I put in a release or an autorelease, the code crashes on an invalid reference after loading all the tableViewCells. First the code and t...

How do i compare two traces in instruments for iphone

After recording a memory leak trace in instruments for iphone simulator, how do I compare it with another memory leak trace ? How do I make instruments to show only the new memory leaks which are different from the other compared memory trace ? Thanks, -Viral ...

Can't figure out this leak

SettingsView *settings = [[SettingsView alloc] initWithNibName:@"SettingsView" bundle:[NSBundle mainBundle]]; settings.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self.navigationController presentModalViewController:settings animated:YES]; settings = nil; [settings release]; Instruments claims that the following line i...

Memory leak in asp.net application - W3WP and gen 2 heap continues to grow until AppPool recycles

Hi, We have a large asp.net application that is leaking memory. Perfmon shows that this leak is in managed memory as W3WP private bytes grows at the same rate as bytes in all heaps. I can also see that Gen 2 garbage collections are running but the Gen 2 heap size continues to grow. I took a memory dump and analysed in WinDbg and can ...

iPhone memory leak pointer

Hey guys, another memory management question: I have asked this before, but did not really get an answer: The question is would the following result in a leak or is it ok? NSArray *txtArray = [NSArray array]; NSString *aTxtFieldTxt = [[NSString alloc]initWithString:aTxtField.text]; aTxtFieldTxt = [aTxtFieldTxt stringByTrimmingCharacte...

Xcode's "build and analyze" reports odd memory leaks for this code

Does anyone know why xCode's "build and analyze" would report this line as a "possible memory leak"? goodSound = [[SoundClass alloc] initializeSound:@"Good.wav"]; ///// Here are the 4 files in question: // Sounds.h #import <Foundation/Foundation.h> #import <AudioToolbox/AudioToolbox.h> @interface SoundClass : NSObject { ...

How to avoid the "swapping of death" during development?

Probably everyone ran into this problem at least once during development: while(/*some condition here that somehow never will be false*/) { ... yourvector.push_back(new SomeType()); ... } As you see the program starts to drain all system memory, your program hangs and your system starts to swap like crazy. If you don't rec...

Include statement taking up 1.5 MB of memory?

Hi guys I'm trying to optimize my application here and have started to benchmark snippets of code as to how much memory they are taking up. I just discovered that a single include statement is taking up to 1.5MB of memory. I'm using memory_get_usage() to check for memory used before adn after a snippet of code. The file included include...

iPhone & iPod Touch iAd UIImageView memory Leak

Running my app on device using leaks tells me that iAd is leaking a UIImageView (namely the ad). Does anyone know what this is about/how to fix it?![alt text][1] screenshot of my instruments panel: http://www.freeimagehosting.net/uploads/30446483e5.jpg ...

The various options for solving PermGen problems

Hi I am looking into the various options around garbage collection on a Java 6 18 VM and would like some pointers. We run our application on JBoss, and occasionally there are the infamous PermGen errors during redeploys. There is a lot of conflicting and obsolete information on the internet about the best way to solve or mitigate this ...

PHP Memory Management

I have a few time-consuming and (potentially) memory-intensive functions in my LAMP web application. Most of these functions will be executed every minute via cron (in some cases, the cron job will execute multiple instances of these functions). Since memory is finite, I don't want to run into issues where I am trying to execute a funct...

memory leak in device not in simulator

I have checked using instruments and not found any memory leaks. when i check in device it shows memory leaks with responsible caller -[NSKeyedUnarchiver decodeObjectForKey:] and object is UIRoundedRectButton. I still not using NSKeyedUnarchiver or any type of decoding. Is following code, is responsible for this memory leak ? - (void)s...

TextBox.Text Leaking Memory in WPF Application

I have an application that does a large amount of number crunching on an array of numbers. I have it set to every 100,000 operations to display the status of those numbers. This is just sort of a visual indicator to the operator that the application is still processing, and how close it is to completed. After running the application for...

Add elements and clear a vector of pointers in C++

I would like to add 2 elements to a vector<Node*> and then clear all the elements and release the memory. Does this code do that in a right way? #include <stdlib.h> #include <iostream> #include <vector> using namespace std; class Node { public: int value; // ...and some other fields and methods... }; int main(int argc, char**...

Memory leak on keyboard dismiss

I have a view controller showing UITextField. Here I bring keyboard - (void)viewDidAppear:(BOOL)animated { [wordTextField becomeFirstResponder]; } Then I have button which is dismissing the keyboard without closing controller itself: - (void)cancel:(id)sender { if([wordTextField isFirstResponder]) { [wordTextField...