memory-management

Java app that uses a lot of memory. Use -Xmx?

I have a java app that uses about 15G on a machine with 16G. I don't know if I should set the max heap size. If I set will the jvm eat all the ram up to the limit and then start garbage collecting and stop everything while it churns through 15G or heap objects? If I don't will the jvm hurt performance by not using all of the availab...

Call Release in class or subclass?

My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it? ...

iPhone: Reusing UIViewControllers in order to save memory

Hi, what are best pratices to reuse UIViewControllers? In many apps (including Apple's own examples: e.g. SQLiteBooks), UIViewControllers are allocated and initialized everytime, a UIViewController is pushed to the stack. This increases the use of memory with every new controller, because the objects stay in memory and aren't used again...

Python garbage collection

I have created some python code which creates an object in a loop, and in every iteration overwrites this object with a new one of the same type. This is done 10.000 times, and Python takes up 7mb of memory every second until my 3gb RAM is used. Does anyone know of a way to remove the objects from memory? ...

Objective C creating custom arrays

In other languages I could create a class then use this to create an array of objects in that class eg class price which is used in a performance class to define a price[] prices; in objective C i cant get this to work, how do you do it? The price class is an inherit of NSObject, can I use NSMutableArray? ...

iPhone code leaks and I don't know why

Hi, this is a well known snippet, how to select a picture from the iPhone photo library: - (IBAction)selectExistingPicture { if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker....

iPhone SDK: When running Object Alloc, GeneralBlock-0 show large number of net allocations?

I'm was running an iPhone application I'm working on through the Object Allocations performance tool, and I've noticed that "GeneralBlock-0 has a large (constantly growing) number of net allocations. Even so, the net and overall bytes for this group is consistently zero. Is this normal or does it indicate some a leak or memory manageme...

When is it appropriate to use "delete this"?

Possible Duplicate: Should objects delete themselves in C++? In my application, I'm creating many objects that "own themselves" - in the sense that after they are created and told to "go," only the object itself can determine when it should be deleted. For example, if I was writing a game, I might have multiple Enemy objects. ...

C++ auto_ptr for arrays

In short, I am wondering if there is an auto_ptr like type for arrays. I know I could roll my own, I'm just making sure that there isn't already something out there. I know about vectors as well. however I don't think I can use them. I am using several of the Windows APIs/SDKs such as the Windows Media SDK, Direct Show API which in or...

Structs Vs Classes in .NET Business Layer

I'm stuck in an "advanced" ASP.NET class right now and my instructor just put forth an opinion that I'm not sure about. (I say "advanced" because he's still using HTML tables for page layout and we just talked about the incredibly advanced topic of Master Pages. I need eye bleach!) He states that instead of, say, creating a Person class...

G++ Multi-platform memory leak detection tool

Does anyone know where I can find a memory memory leak detection tool for C++ which can be either run in a command line or as an Eclipse plug-in in Windows and Linux. I would like it to be easy to use. Preferably one that doesn't overwrite new(), delete(), malloc() or free(). Something like GDB if its gonna be in the command line, but...

Thread specific memory with language features.

Are there languages that support process common memory in one address space and thread specific memory in another address space using language features rather than through a mechanism like function calls? process int x; thread int y; ...

Why are subviews of an NSView not sent a release message when a Cocoa application terminates?

The short version: Why are the subviews of NSView objects not sent a release message when a Cocoa application terminates? Is there a way to override this behaviour? An example: The MyView class shown below is nothing more than an NSView subclass that reports to the console when it is created and destroyed. I have tested it out and ...

How can I unset an (unsigned) integer in ActionScript/Flex 3?

I have a class which is called a number of times. When the application goes to the next stage these all have to be unloaded. Because of that, I created an unload() method in the class. The problem is that I can't seem to set my uint variable "charId" to null in order to "unset" it. The "delete" command is not possible either as that is ...

Thousands of new 0 size objects being added to my net total every second, should I be worried?

I have just finished ridding my project of leaks, but there are still thousands of objects under the category "GeneralBlock-0". The number of net allocations is through the roof (its approaching a million as I type) but none of them are leaks and none of them have a size greater than 0 bytes. UPDATE & EDIT: QuartzCore is responsible f...

iPhone SDK: I have memory issues, can anyone help a newbie fix them?

Hello, I have been developing on the iPhone platform for a very short time, and already I've had my fare share of syntax errors, and now memory issues. In my iPhone app an image view is animated multiple times by different buttons(6), and this works well on the iPhone without problems, but when I tested my app with instruments for the f...

Bug in MKMapView?

When I open MapView with navigationcontroller in a new view, then not waiting till map loads, and then clicking on the back button - I an exception is thrown. Can anyone confirm this? What is a work-around? ...

Double releasing when it shouldn't be happening

I am really puzzled by this. I believe I am managing memory the correct way but executing the code suggests that I am double releasing the object. Here is the code and then I'll explain what is happening. @protocol SomeDelegate <NSObject> @required - (id)initWithCols:(NSUInteger)Cols Rows:(NSUInteger)Rows; @end @interface SomeObject :...

How commons dbcp (and other connection pools) manage open statements and resultsets?

Specifically, when I return a connection to the pool, does dbcp (and other connection pools) close the statements and resultsets for me? Or should I be closing these myself? ...

Should you set the delegate to nil in the class using the delegate or in the class itself

If class A is using class B and class A is class B's delegate, is it ok if the delegate is set to nil in class B's dealloc? I have seen code usually resetting the delegate to nil inside class A's dealloc but wasn't sure the real difference doing it one way or the other. e.g. This is the usual way: // somewhere in class A - (void) some...