memory-management

iPhone Instruments Leaks is confusing me. UIView fade out animation causes a lot of tiny leaks

I'm trying to kill all memory leaks in my iPhone 3.0 application. CLANG builds with all lights green so now I'm analyzing with Instruments. This is easier said then done, since it is indicating hundreds of 16 byte leaks after just a few minutes of using the app. It seams to be mainly in UIKit, and the common part is that the end of the...

Are instance variables set to nil by default in Objective-C?

Hi there, I'm sorting out some memory issues with my iPhone app and I've just been thinking about some basics. If I setup an ivar and never end up using it in the lifespan of my object, when I call dealloc on it, will that cause a problem? E.g. @interface testClass { id myobject; } @property (nonatomic, retain) id myobject; @end @...

Why doesn't FastBitmap get garbage collected?

So I've finally located a problem I have with growing memory consumption. It's the class below, which for some reason doesn't get garbage collected. What would be the problem? The idea of the FastBitmap class is to lock the bitmap data of a bitmap image once to avoid locking/unlocking on each call to GetPixel/SetPixel. public unsafe cl...

JVM and CLR allocation optimization

Do the JVM and .NET VM allocate objects on the stack when it is obvious to the runtime that an objects lifetime is limited to a certain scope? ...

Memory leak on return object

I have a hard time grasping this memory leak in my code. Basically it's returning an object containing a object. here's the following code: -(id) getOptions { FileManager *file = [[FileManager alloc] initWithFileName:@"optionsFile.dat"]; Options *options = [[Options alloc] init]; NSMutableArray *fileArray = [[NSMutableArray ...

UIView isn't released. Calling delegate with self, and using UIView commitAnimations adds retain count

I have a view that is added as a subview in a viewcontroller. The subview has delegates methods and the viewcontroller is assinged as its delegate. The subview has a animation and calls a delegate method when the animation is finished. The problem is that when the viewcontroller is removed from the view by the navigationcontroller the s...

How to access physical memory in linux from userspace ?

Hi, I have a physical memory address, which driver provide me through ioctl. How can I access it in my application in linux. ...

COCOA Objects Allocation/Deallocation + Memory Optimization

Hello friends, Ah.. We've developed a good iPhone application. Now, 'm passing through last phases of it, i.e. profiling it and I've encountered few problems. Application has few leaks and objects occupying large memory chunks. We just checked somehow, application is not lowering its memory requirements and blocks remain occupied with c...

Does my code leak memory (python)?

links_list = char.getLinks(words) for source_url in links_list: try: print 'Downloading URL: ' + source_url urldict = hash_url(source_url) source_url_short = urldict['url_short'] source_url_hash = urldict['url_short_hash'] if Url.objects.filter(source_url_short =...

What are the side effects of using EmptyWorkingSet?

Hi, I'm using the code below to free up memory on some running programs because my own program needs large memory resources to run faster. [DllImport("psapi.dll")] public static extern bool EmptyWorkingSet(IntPtr hProcess); public FreeMem(string programName){ EmptyWorkingSet(Process.GetCurrentProcess().Handle); foreach(Pro...

c# picturebox memory releasing problem

Hi everybody. I'm a newby in C#. I have to repeatedly refresh a GUI picture box in a worker thread. The image is acquired from a camera polling a driver with a GetImage method that retrives the image to be displayed. Even if I allocate the bitmap using directive "using" and explicitly call G.C, memory seems to be never deallocated. The...

Using dismissModalViewControllerAnimated won't free any memory

I have a very simple code to show a modal controller (nextController is a class member): nextController = [[InstructionsScreen alloc] initWithNibName:@"InstructionsScreen" bundle:nil]; [self presentModalViewController:nextController animated:YES]; [nextController release]; And then when the controller should hide: [self dismissModalV...

Understanding NSS PK11_CipherOp and C memory allocation

Hey all, Having some issues with C. I have this is my code: // First line works, second line does not! char outbuf[1024]; // char *outbuf = (char *) malloc(1024); // char is always 1 I am passing this outbuf to a method called PK11_CipherOp(), declared in the NSS library. The Documentation for this method can be found here, you ca...

How to handle NSZombies in an asynchronous NSURLConnection?

Hi, I'm currently asynchronously using NSURLConnection with several UIViews (every view handles NSURLConnection as delegate). The problem I have is when user switches views too fast and the delegate becomes NSZombie the app crashes - that is NSURLConnection doesn't have living delegate anymore. So, the first question is if there's a way...

Can I simulate memory scarcity to ferret out a memory leak with a smaller source dataset in a .NET application?

I have an application which predictably generates out-of-memory errors on very, very (very) large datasets - we're trying to fix the problem by optimizing the app's memory management, but the very, very large datasets in question require so long to run (days) that it's difficult to iterate through testing cycles and find the problem empi...

Can I force memory cleanup in C#?

I heard that C# does not free memory right away even if you are done with it. Can I force C# to free memory? I am using Visual Studio 2008 Express. Does that matter? P.S. I am not having problems with C# and how it manages memory. I'm just curious. ...

Best way to track changes on a website for visitors' information

So I've been saddled with furthering a website, in which it is crucial that the visitors are able to see exact changes that were made in content since the last time they visited (i.e., some form of tracking system that keep pervious versions that can also be accessed). In my mind, I'm thinking of something like the history tabe in wiki...

Is it normal for memory warnings to disappear?

Hi, I've had lots of problems getting a simple UIImagePicker working (see my other posts), and I've been getting memory warning notifications after taking a picture and before I even get a chance to dismiss the UIImagePicker Now, however... I've loaded up my app in Xcode today and all is working fine. Can't get the memory warning at al...

Why don't managed languages offer the ability to manually delete objects?

Lets say you want to write a high performance method which processes a large data set. Why shouldn't developers have the ability to turn on manual memory management instead of being forced to move to C or C++? void Process() { unmanaged { Byte[] buffer; while (true) { buffer = new Byte[10240...

A dynamic buffer type in C++?

I'm not exactly a C++ newbie, but I have had little serious dealings with it in the past, so my knowledge of its facilities is rather sketchy. I'm writing a quick proof-of-concept program in C++ and I need a dynamically sizeable buffer of binary data. That is, I'm going to receive data from a network socket and I don't know how much the...