memory-management

Help with memory problem on iOS/iPad

Hello - In my app, I have a bunch of different image packs to download. The images are downloaded from my website one by one. The packs contain anywhere from 100-1500 images and each image is about 100KB-200KB. When downloading the images, I have a method that selects the images to download, then I have a second method that does the act...

Runtime error accessing a vector

In my C++ project, I have a class App, and a class Window. Class App has a parameter: vector<Window*>* window;. In App's constructor, it is able to use and push_back a Window* onto this vector fine, but in my onMessage() method, which is called by the WndProc() (I'm using winapi), it gives me an runtime error when I try to use the vecto...

any haXe GC tips?

Recently I am learning haXe for flash, and I have few actionscript3 experience. HaXe is really good language. I notice there is a delete operation in as3, Is there some like delete in HaXe? Is the "delete" about gc? Is there any tips for haXe newbie about memory management, thanks? ...

iPad application out of memory after only 5MB

I've looked carefully at leaks and I have none (very few - all under 400 bytes). I've read a few posts about not using imageNamed calls as they cache the images. I'm not using any of those. I'm using imageWithContentsOfFile. I AM using lots and lots of images. Mostly rendered myself using graphics contexts. I'm releasing everything and ...

Free memory after iphone animation

My app crashes due to memory building up after every animation. Here is my sample code: -(IBAction) shoot: (id)delegate{ [gun setImage:[UIImage imageNamed:@"animation_machin_guns_320x480_7.png"]]; UIImage *frame1 = [UIImage imageNamed:@"animation_machin_guns_320x480_1.png"]; UIImage *frame2 = [UIImage imageNamed:@"animation_machin_guns...

When to use self and when to use retain

Hi, am working my way through the "Beginning iPad Development" Apress book and have noticed that sometimes when the author is assigning values to a property they will use: self.variable = value; and other times, they will use: variable = [value retain]; In both cases variable is a property defined as: @property (nonatomic, retain)...

One xib file or multiple xib files

I made a tab bar application that has only one xib file. If you have have made tab bar applications before then you probably know what I did so I don't really have to explain it. I deleted the two xib files and used MainWindow.xib. I just added views to each tab bar button and assigned view controllers to each of them. So now I have a t...

Bad access while parsing with NSXMLParser

I use following code for parsing: //init parser with readStr NSData* xmlData = [stringToParse dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; NSXMLParser* xmlParser = [[NSXMLParser alloc] initWithData:xmlData]; //parse with events [xmlParser setDelegate:self]; [xmlParser parse];//<<<< BAD ACC...

Removing views from UIScrollView

Using the PhotoScroller example from Apple, to reuse the memory allocated for views, I cannot get the memory released once the retain count hits 0. Here my code for a better understanding: This piece is an extract from PhotoScroller PhotoViewController.m - (void)configurePage:(ImageScrollView *)page forIndex:(NSUInteger)index { ...

Learning C coming from managed OO languages

I am fairly comfortable coding in languages like Java and C#, but I need to use C for a project (because of low level OS API calls) and I am having some difficulty dealing with pointers and memory management (as seen here) Right now I am basically typing up code and feeding it to the compiler to see if it works. That just doesn't feel ...

Received memory warning. Level=2

hi i want to get 6 Mb (Html file size)Data from web service.Its run fine on Simulator but when i run that application on ipad its give me an error Received memory warning. Level=2. ...

Why doesn't strncpy work with a string allocated with malloc?

char* temp; temp = (char*) malloc (strlen(window->entry.value)+1); //strncpy( temp, window->entry.value, sizeof(temp) ); DOESN"T WORK memcpy (temp, window->entry.value, strlen(window->entry.value) + 1); //WORKS (where window->entry.value is a string.) Thanks. ...

Default for XX:MaxDirectMemorySize

What is the default value for XX:MaxDirectMemorySize for SUN JVM 1.6? ...

Artifically Limit C/C++ Memory Usage

Is there any way to easily limit a C/C++ application to a specified amount of memory (30 mb or so)? Eg: if my application tries to complete load a 50mb file into memory it will die/print a message and quit/etc. Admittedly I can just constantly check the memory usage for the application, but it would be a bit easier if it would just die...

deleting object pointer referring by two pointers

I have an object say. ClassA *obj1 = new ClassA; ClassA *ptr1 = obj1; ClassA *ptr2 = obj1; When I do delete ptr1;, will it affect ptr2? If so what can be the correct solution for this? ...

Incorrect decrement of the reference count of an object that is not owned at this point by the caller in iphone

Hi all, I'm getting a memory warning: "Incorrect decrement of the reference count of an object that is not owned at this point by the caller" for challengeCell at the marked line. myIdentifier = @"ChallengTblVwCell"; ChallengeTableViewCell *challengeCell = (ChallengeTableViewCell *)[tableView dequeueReusableCellWithIdentifier:myIde...

Want to know whether enough memory is free on a linux machine to deploy a new application.

I have got a linux machine whose memory snapshot when I do /proc/meminfo is : MemTotal: 16413388 kB **MemFree: 48296 kB** Buffers: 193600 kB Cached: 1986448 kB SwapCached: 874512 kB Active: 15034264 kB Inactive: 713672 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 16413388...

Keeping memory usage within available amount

I'm writing a program (a theorem prover as it happens) whose memory requirement is "as much as possible, please"; that is, it can always do better by using more memory, for practical purposes without upper bound, so what it actually needs to do is use just as much memory as is available, no more and no less. I can figure out how to prior...

questions about memory managnement on iphone

hello, imagine i have a main view, in which i have a call to the "AddSubview" method, like this : [mainView addsubview:secondView]; ...in this second view, i have a searchBar, with the appropriate code to show a UIkeyboard, type some text, use this one in the app, and finally dismiss the UIkeyboard. Ok. When this part of the program ...

Stack and Heap Space for Modern Computers

When writing in C, how can I tell how much stack space is available in memory when I launch a program? How about heap space? How can I tell how much memory is being used during the execution of my program? ...