memory-leaks

Apple's Sample App TopSongs has 26 Leaks, Ugh!

Hey all, I've been building an app for a client and part of it uses Apple's TopSongs sample app to download data on another thread. I finally got enough done to start testing that part and found >1000 leaks!!! A closer look at the leaks made me check TopSongs for leaks, since none of the my methods were in leaks report. Running TopSongs ...

WPF User Control is causing Out of Memory Exception

Looking for a free spell checking solution, I thought I was so smart in doing this but I guess not. I have created a windows form based application and I want the form to add a user specified amount of user controls (with textboxes) on to a panel. The user can then click some button and the controls on this panel are cleared and new one...

Python program doesn't quit when finished

I have the following script 186.py: S=[] study=set([524287]) tmax=10**7 D={} DF={} dudcount=0 callcount=0 def matchval(t1,t2): if t1==t2: global dudcount dudcount+=1 else: global callcount callcount+=1 D.setdefault(t1,set([])) D.setdefault(t2,set([])) D[t1].add(t2) ...

Resources to read about Databinding causing memory leaks in WPF?

My wpf app is eating memory every time the ItemsSource of a TreeView is replaced (I simply construct a new object and assign it to the bound property). Furthermore the memory hoarding only occurs when I use a DataTemplate that is used in other ItemControls too. When I remove the DataTemplate the Treeview reverts to displaying the ToStri...

How else can I avoid leaking this Core Foundation object?

The following leaks: CFStringRef labelName = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(aMultiRef, indexPath.row)); cell.textLabel.text = (NSString *)labelName; CFRelease(labelName); Wondering if there a way to rewrite it so it doesn't leak without breaking out & assigning ABMultiValueCopyLabelAtIndex(aMultiR...

Noob pointer/array question

I know this is probably a stupid question, but I need to be sure; I came accross some legacy code that contains a function like this: LPCTSTR returnString() { char buffer[50000]; LPCTSTR t; /*Some code here that copies some string into buffer*/ t = buffer; return t; } Now, I strongly suspect that this is wrong. ...

Memory leak while asynchronously loading BitmapSource images

I have a fair few images that I'm loading into a ListBox in my WPF application. Originally I was using GDI to resize the images (the originals take up far too much memory). That was fine, except they were taking about 400ms per image. Not so fine. So in search of another solution I found a method that uses TransformedBitmap (which in...

Simple jQuery Ajax call leaks memory in Internet Explorer

I created a web page that makes an Ajax call every second. In Internet Explorer 7, it leaks memory badly (20 MB in about 15 minutes). The program is very simple. It just runs a JavaScript function that makes an Ajax call. The server returns an empty string, and the JavaScript code does nothing with it. I use setTimeout to run the functi...

Memory leak on CollectionView.View.Refresh

I have defined my binding thus: <TreeView ItemsSource="{Binding UsersView.View}" ItemTemplate="{StaticResource MyDataTemplate}" /> The CollectionViewSource is defined thus: private ObservableCollection<UserData> users; public CollectionViewSource UsersView{get;set;} UsersView=new CollectionViewSource{Source=users}; Us...

Memory leak when returning object

I have this memory leak that has been very stubborn for the past week or so. I have a class method I use in a class called "ArchiveManager" that will unarchive a specific .dat file for me, and return an array with it's contents. Here is the method: +(NSMutableArray *)unarchiveCustomObject { NSMutableArray *array = [NSMutableArray a...

Returning objects with autorelease but I still leak memory

I am leaking memory on this: my custom class: + (id)vectorWithX:(float)dimx Y:(float)dimy{ return [[[Vector alloc] initVectorWithX:dimx Y:dimy] autorelease]; } - (Vector*)add:(Vector*)q { return [[[Vector vectorWithX:x+q.x Y:y+q.y] retain] autorelease]; } in app delegate I initiate it: Vector *v1 = [[Vector alloc] initVector]; Vec...

Is Tomcat 6 ready for continuous integration or how to get it work?

I'm looking for a hint how to make tomcat CI ready or an servlet container / application container which stand often redeploys like they happen when using hudson ci. I experienced that Tomcat 6 does not properly undeploy webapps, leaving classes in jvm. For example I monitored tomcat 6 with VisualVM: on start 2000 classes, on deploy ...

memory (leaks) after executing

I'm wondering why randomly after executing the ./a.out I get the following. Any ideas what I'm doing wrong? Thanks http://img710.imageshack.us/img710/8708/trasht.png ...

JVMTI: FollowReferences : how to skip Soft/Weak/Phantom references?

I am writing a small code to detect number of objects left behind after certain actions in our tool. This uses FollowReferences() JVMTI-API. This counts instances reachable by all paths. How can I skip paths that included weak/soft/phantom reference? (IterateThroughHeap counts all objects at the moment, so the number is not fully r...

mem-leak freeing g_strdup

I'm trying to free g_strdup but I'm not sure what I'm doing wrong. Using valgrind --tool=memcheck --leak-check=yes ./a.out I keep getting: ==4506== 40 bytes in 10 blocks are definitely lost in loss record 2 of 9 ==4506== at 0x4024C1C: malloc (vg_replace_malloc.c:195) ==4506== by 0x40782E3: g_malloc (in /lib/libglib-2.0.so.0.2200...

What should the retainCount be when returning an object in Objective-C?

See title. To be more specific, I am trying to return the mutableCopy of an object, however it's returned with a retainCount of 1 and I am worrying that it will leak. ...

IPhone SDK - Leaking Memory with performSelectorInBackground

Hi. Maybe someone can help me with this strange thing: If a user clicks on a button, a new UITableView is pushed to the navigation controller. This new view is doing some database querying which takes some time. Therefore I wanted to do the loading in background. What works WITHOUT leaking memory (but freezes the screen until everythin...

JS: using 'var me = this' to reference an object instead of using a global array

The example below, is just an example, I know that I don't need an object to show an alert box when user clicks on div blocks, but it's just a simple example to explain a situation that frequently happens when writing JS code. In the example below I use a globally visible array of objects to keep a reference to each new created HelloObj...

Memory leak found with clang but cant release and autorelease crashes

I have a class that builds a request based on a few passed in variables. The class also has all the delegate methods to receive the data and stores it in a property for the calling class to retrieve. When the class initializes it creates a connection and then returns itself: NSURLConnection *connection; if (self = [super init]) { ...

How is dynamic memory allocation handled when extreme reliability is required?

Looks like dynamic memory allocation without garbage collection is a way to disaster. Dangling pointers there, memory leaks here. Very easy to plant an error that is sometimes hard to find and that has severe consequences. How are these problems addressed when mission-critical programs are written? I mean if I write a program that contr...