memory-management

Available memory for iPhone OS app

Is there a function or constant defining the amount of available memory for an app in iPhone OS? I'm looking for a device-independent way (iPod touch, iPhone, iPad) to know how much memory the app has left. ...

How variables are allocated memory in Javascript?

I would like to know how local variables are allocated memory in javascript. In C and C++ local variables are stored on stack. Is it the same in javascript? or everything is stored in heap? ...

How do I keep from running out of memory on graphics for an Android app?

I've been working on an Android app in Eclipse, and so far, my program hasn't really grown past midget size. However I've already run into an issue with an Out of Memory error. You see, I've been using graphics comprised solely of bitmaps and PNGs in this program, and recently, when I tried to add a little bit more functionality to the...

Changing pointer of self

I have an object that I alloc/init like normal just to get a instance. Later in my application I want to load state from disk for that object. I figure I could unarchive my class (which conforms to NSCoding) and just swap where my instance points to. To this end I use this code... NSString* pathForDataFile = [self pathForDataFile]; if([...

Memory mapped files causes low physical memory

I have a 2GB RAM and running a memory intensive application and going to low available physical memory state and system is not responding to user actions, like opening any application or menu invocation etc. How do I trigger or tell the system to swap the memory to pagefile and free physical memory? I'm using Windows XP. If I run the s...

Simple Obj-C Memory Management Question

This is from some sample code from a book // On launch, create a basic window - (void)applicationDidFinishLaunching:(UIApplication *)application { UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[HelloControll...

Efficient data structure for word lookup with wildcards

Hi there, I need to match a series of user inputed words against a large dictionary of words (to ensure the entered value exists). So if the user entered: "orange" it should match an entry "orange' in the dictionary. Now the catch is that the user can also enter a wildcard or series of wildcard characters like say "or__ge" which wo...

Debugging unexpected error message - possible memory management problem?

I am trying to debug an application that is throwing up strange (to my untutored eyed) errors. When I try to simply log the count of an array... NSLog(@"Array has %i items", [[self startingPlayers] count]); ...I sometimes get an error: -[NSCFString count]: unrecognized selector sent to instance 0x1002af600 or other times -[NSConc...

How Manage Big Linq DataContext ?

Hi The major subject in .net programs is "How manage memory for best performance". so Microsoft use garbage collector in .net and with that, we don't need to do something for managing memory(or better say we can use GC easily) But when you develop big project(business app), you make too many tables and database for your own project. s...

Objective-C: alloc of object within init of another object (memory management)

In my .h file I have: NSMutableArray *myArray; @property (nonatomic, retain) NSMutableArray *myArray; My .m file looks basically like this: @synthesize myArray; - (id) init { self = [super init]; if (self != nil) { self.myArray = .... ? // here I want to create an empty array } return self; } - (void) ...

Preallocating memory with C++ in realtime environment

I'm having a function which gets an input buffer of n bytes, and needs an auxillary buffer of n bytes in order to process the given input buffer. (I know vector is allocating memory at runtime, let's say that I'm using a vector which uses static preallocated memory. Imagine this is NOT an STL vector.) The usual approach is void proces...

UINavigationController and memory management

- (void)launchSearch { EventsSearchViewController *searchController = [[EventsSearchViewController alloc] initWithNibName:@"EventsSearchView" bundle:nil]; [self.navigationController pushViewController:searchController animated:YES]; //[searchController release]; } Notice the [searchController release] is commented out. I've unders...

Why am I getting *** _NSAutoreleaseNoPool(): Object 0x97480b0 of class NSCFDictionary autoreleased with no pool in place - just leaking.

I have noted several other threads on this topic and have tried wrapping my threaded code with: NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [pool release]; but the errors still come. I am using a static method to instantiate a dictionary of words. Here is some code: -(id)init [NSThread detachNewThreadSelector...

iphone SDK: UIView dealloc not called. Why?

I have a custom UIView called TiledImage which has a single property named tiledImage and a custom drawRect method. I add this view to my ViewController, but when the ViewController is deallocated the dealloc for this view is never being called, even though I am releasing the view and setting it to nil. What could be causing this? I don'...

Can I just release the top object (iPhone)?

If I release the object that's holding a reference to the variable that I need to release, is that sufficient? Or must I release at every level of the containment hierarchy? I fear that my logic comes from working with a garbage collector for too long. For instance, I assigned to this property of a UIPickerView instance by hand instead ...

Sanity Check - will a stl::Container of new'd objects each be deleted when the container itself dies?

Title pretty much covers it. If I've added say 3 objects to a list and the list goes out of scope and dies, will it call delete on each entry before going out of scope? Pretty sure yes, but getting tired and need a sanity check. ...

UIViewController memory management

Hi I have a very basic issue of memory management with my UIViewController (or any other object that I create); The problem is that in Instruments my Object allocation graph is always rising even though I am calling release on then assigning them nil. I have 2 UIViewController sub-classes each initializing with a NIB; I add the first Vi...

Does tbb:concurrent_queue "grow" like std::vector? How to release its buffers?

Hello, I'm wondering if tbb:concurrent_queue can grow its internal buffers when it's under high load, and then not release the buffers? How to obtain any information about the buffers and/or release them? PS. In vector, you have methods like .reserve() to allocate and .swap(vector()) to completely release any buffers. ...

Why do I have a memory leak in UIApplication

I have an iphone app project. I analysed it using instruments memory leak tool. According to instruments I have 2 leaks the Trace is as follows: start main UIAplicationMain _run CFRunLoopInMode CFRunLoopRunSpecific PurpleEventCallback _UIAplicationHandleEvent sendEvent: handleEvent:withNewEvent: After this trace there are two separat...

Creating a "permanent" Cocoa object

I have an object factory that hands out instances of a few "constant," immutable objects. I'd like these objects to be protected against bad memory management by clients. This is how I've overridden the class's key methods. Am I missing anything (code or other considerations)? - (id)retain { return self; } - (NSUInteger)retainCount...