I finally understand whether I must release an object, and how to keep my retain counts as low as possible in a trivial application (by knowing whether the object comes back with an extra 'retain' already called or not). So the NARC rules are working pretty well in that regard.
On the other hand, I can't wrap my head around whether to r...
I am new to programming (learned how to write apps a few months ago) and recently wrote an app that crashes every time after about 5 minutes with several 'Received memory warning. Level=1' warnings. While testing with instruments, I have been unable to detect any leaks and I'm fairly confident I'm releasing the objects correctly so I su...
Hi there,
I am having problem finding a memory leak with Instruments. Usually it helps me a lot and I am able to find the leak, but in this case I'm lost.
I am creating a view controller that controls a views loaded from NIB file. The view has Map View with "Show user location" on true. Once user location is found I use MKReverseGeocod...
Using C, is there a safer way to allocate memory than using malloc? For example, is there a C equivalent of a smart pointer, or some handy function that someone has come up with that makes the process of allocation a little cleaner? I mean, sure, it's only one line anyway, but there must be a more concise way to get it done. I suppose...
I have 2 arrays, 1 in the viewDidLoad method and 1 in the add method(adds an object to favorites)
NSUserDefaults *myDefault = [NSUserDefaults standardUserDefaults];
NSArray *prefs = [myDefault arrayForKey:@"addedPrefs"];
userAdded = [[NSMutableArray alloc] initWithArray:prefs];
Instruments is showing leaks from these prefs NS...
What is the comfortable range for a running iphone app.
My app currently peaks around 5.4 mb and would like to know the correct amount which causes crashes.
I have heard that on the iphone 3G there is around 40 mb minus the running apps such as Mail, Safari etc.
Does anyone know the truth around this?
...
So Instruments tells me I have three memory leaks originating in this method (specifically, it points out the line:
[self.view addSubview:menuBar.view];
I can't see a leak and am racking my brains. I'm keeping a reference to the menuBar object and am releasing it. Anyone smarter than me that can explain? Is it a coincidence that I have ...
Hello guys,
I am trying to hack an old unix kernel. I just want to implement the MMU and TLB using software. Can some one tell me what are the best Data structures and algorithms to use in building one. I saw lots of people using splay trees because its easy to implement LRU. Is there any better Data Structure ? What is the most efficie...
Hi,
I do not understand why Instruments/Leaks tells me that there is a memory leak in my viewDidLoad. I do release both objects in dealoc and set them to nil in viewDidUnload. Can someone give me a clue here?
Link to screen-dump from Instruments: http://i26.tinypic.com/28227iw.png
BR
//Christoffer
...
Probably all that I'm asking for is a link to a website that I have yet to find. But coming from a Java background, what are the general guidelines for handling memory allocation and deletion in C++? I feel like I may be adding all sorts of memory leaks to my application. I realize that there are several variants of smart pointers, an...
The standard specifies that the contents of reallocated space is undefined if the new size if larger.
If preserving the contents of the previously-allocated space is important, is the best way to reallocate data as follows: copying it to the stack, freeing it from the heap, allocating on the heap with more space, and copying back to the...
What is the proper/preferred way to allocate memory in a C API?
I can see, at first, two options:
1) Let the caller do all the (outer) memory handling:
myStruct *s = malloc(sizeof(s));
myStruct_init(s);
myStruct_foo(s);
myStruct_destroy(s);
free(s);
The _init and _destroy functions are necessary since some more memory may be alloc...
i have following question
i have RAM 2.5 GB in my computer what i want is if it is possible that in case of allocate totally memory to some process or for example
char * buffer=malloc(2.4GB) , no more process ( google chrome, microsoft games in computer..etc) can run?
...
Say we have a class with 10000 const string members.
class Schema
{
//Average string length is 20
public const string ID1 = "some.constant.value";
public const string ID2 = "some.other.constant.value";
//...
}
Not all fields are referenced in the rest of the code. Only 10% of them is accessed on startup - their reference is as...
Imaging having a stack of protocols and some c/cpp code that neatly covers
sending on each layer. Each send function uses the layer below to add
another header until the whole message is eventually placed into a
continuous global buffer on layer 0:
void SendLayer2(void * payload, unsigned int payload_length)
{
Layer2Header header; ...
Alright, this is an elementary question but I'm asking because I honestly don't understand how to properly manage this. If I uncomment the last two lines, this code crashes, even though I don't think it should.
The following code is from a custom subclassed UILabel where I added the following method, setTextFromFloat.
-(void)setTextFr...
Is the viewDidUnload method called even if the view controller is dealloced? It seems natural that it´s not called, but I cannot find an answer.
In that case objects released in the viewDidUnload: also need to be released in dealloc, right?
...
I've read uiimagepickercontroller uiimage memory and more and other relevant questions, but I can't get my head around one thing, and I wonder if there are people around here with experience on this particular aspect.
In my app I let the user select an image from his library, ultimately resulting in an upload. (An interesting thing here...
I'm writing a database-style thing in C (i.e. it will store and operate on about 500,000 records). I'm going to be running it in a memory-constrained environment (VPS) so I don't want memory usage to balloon. I'm not going to be handling huge amounts of data - perhaps up to 200MB in total, but I want the memory footprint to remain in the...
Ok everyone, I have an excellent challenge for you. Here is the format of my data :
ID-1 COL-11 COL-12 ... COL-1P
...
ID-N COL-N1 COL-N2 ... COL-NP
ID is my primary key and index. I just use ID to query my database. The datamodel is very simple.
My problem is as follow:
I have 64Go+ of data as defined above and in a real-time applic...