Hi,
The Cocoa "Memory Management Programming Guide" document says:
You take ownership of an object if you create it using a method whose name begins with “alloc” or “new” or contains “copy” (for example, alloc, newObject, or mutableCopy), or if you send it a retain message. You are responsible for relinquishing ownership of objects y...
When converting a NSString to a char* using UTF8String, how to retain it?
According to the following link, when you use UTF8String the returned char* is pretty much autoreleased, so it won't last beyond the current function: http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSString_Class/Referen...
Hi, I'm trying to use sqlite in a 'data services' class like below. I keep getting an error code 1 when calling 'sqlite3_prepare_v2'. The logs certainly back up that the database is getting opened before my recipeNames function is called. I'm so stumped! Is it a memory management thing with the sqlite3 *db ? Eg is it getting freed when i...
Is there a way (with iOS4) when the user hits the home button (in order to exit an application) to convey to the iOS4 system to not keep the app running in the background but to remove the app completely from memory (like iPhone 3)? My app could potentially display sensitive information and I'd like for it to exit completely.
Thanks
...
I keep getting bad instruction or bad exception so I enabled NSZombieEnabled and the other vars needed, and I have no idea how to analyze the results. This is what was logged:
ToDoWall(1634) malloc: recording malloc stacks to disk using standard recorder
ToDoWall(1634) malloc: stack logging compaction turned off; size of log files on d...
Hello guys,
I 'm trying to develop an Image Processing application for the images stored
at the photo library of the iPhone, but to tell the truth I am confused.
I'm interested in getting the A R G B matrixes out of the image. then make
some algorithm with these matrixes and then releasing them.
What would you prefer for the aforemention...
Hi,
I have several places where I need to display an alert and handle the dismiss operation in the same way, namely take them to the same view controller. Instead of duplicating the alert specific code in all those places, I created a separate class like below:
AlertUtility.h:
@interface AlertUtility : NSObject {
}
- (void) displayAl...
Hi,
If I have an array created like this:
MyType *array = new MyType[10];
And I want to overwrite one of the elements, do I have to delete first the old element like this:
delete &array[5];
array[5] = *(new MyType());
Or is this completely wrong and do I have to work with something like "pointers to pointers" to fix this job? If s...
I was reading http://duartes.org/gustavo/blog/post/motherboard-chipsets-memory-map and in specific, the following section:
In a motherboard the CPU’s gateway to
the world is the front-side bus
connecting it to the northbridge.
Whenever the CPU needs to read or
write memory it does so via this bus.
It uses some pins to trans...
If I want to check a program for memory leaks, what method should I use to go about this?
What software is available and how do you use that software? I'd like to see if there is a memory leak occuring in some code I have here and I'm not really sure how to check it.
Thanks!
...
In Objective-C, if I have a method in which I allocate and initialize an object, then return it, where/how do I release it?
for example, let's say I have a method where I create an object:
- (void)aMethod {
UIView *aView = [self createObject];
}
- (UIView *)createObject {
UIView *returnView = [[UIView alloc] initWithFrame:CGRe...
INFORMIX-SE 4.10.DD6 on DOS 6.22 ((DOS16M=3):
I'm trying to run a protected mode Informix-SE engine executable but im getting the error message described in the title of this post. DEVICE=C:\DOS\HIMEM.SYS is the first entry in my CONFIG.SYS and MEM.EXE says I have 616K of REAL MEM available. I'm using using DOS16M switch = 3 and the exe...
Hi,
My question is when a object is actually added to autorelease pool?
When a Autorelease pool is created and objects are declared within the scope, are they added in autorelease pool or they are added in pool when specified as autoreleased.
int main(void) {
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
...
Hi,
i am trying to create an background thread that updates a Runnable at a given interval.
It should also not prevent the "parent" from beeing garbage collected.
My problem is as follows. My WeakReference seems to act as a "strong" Reference, It doesn't stop my thread form accessing the runnable that i am supposed to have made availab...
Hi there!,
I have an object
id currentObject;
which I want to pass through notification. The problem is I don't know how to release it correctly and the memory management documentation is driving me crazy.
I am doing it like this right now:
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageReceived" object:nil us...
Hi all,
I've some memory issues with a view controller that contains a text field.
Brief summary:
Clicking on a button my application modally presents a UIViewController (that I will call "VC1").
From VC1 the user can optionally open (using pushViewController) a UITableViewController ("VC2") and turn back.
From VC1 the user can optional...
Here's my situation - I have a simple object model. At the root, there's a Report object. Reports have an array of Documents. Each document has an array of Chapters and Page. Each of these objects has 4 or 5 properties (primitives - strings and integers). It looks something like this:
Report
List< Document>
List < Chapter>
List ...
I have been developing a small Java utility that uses two frameworks: Encog and Jetty to provide neural network functionality for a website.
The code is 'finished' in that it does everything it needs to do, but I have some problems with memory usage. When running on my development machine the memory usage seems to fluctuate between abou...
I have been slowly learning iPhone development and seem to keep hitting walls where I can't figure out how to do what I want to do the right way :(
Basically, I want a class that handles all interactions with the data layer, for example, getting a mutable array of some list of objects from the data store.
This is pretty trivial in othe...
Hi all,
I get this message. The thing is, I want to be able to tell cocoa to just not send the notification if the object no longer exists. Is there a way to do that?
The broader picture:
I'm sending requests to a server, but while that request is going on, maybe the user has done something to destroy the object expecting the reques...