memory-management

any difference between these two dealloc methods?

So i'm overriding dealloc method because the object is a composite object made up of one other object. I originally had this dealloc method: -(id) dealloc; // Override to release the Rectangle object’s memory { [rect release]; [super dealloc]; return self; } After looking in the book I saw another answer: { [rect rel...

Memory management with dictionaries / possible misinterpretation by GCC?

Hi, Somewhere on my code I need to create several windows from a main window, each functioning with a specific configuration but all instances of the same controller object. I also need to keep a list of open windows, so whenever I open a window I store its instance in a dictionary and when the window is closed I send a notification to...

Help debugging iPhone app - EXC_BAD_ACCESS

Hi, I've developed my application using my 3G device to test with. Upon giving this to a friend to test, he's noticed that it crashes..I've had a look at the crash log, but it's not much use except for the "EXC_BAD_ACCESS" statement after a few memory warnings. On my device, I can use the imagePicker lots, and each time a photo is take...

Overreleasing here?

I have been getting EXC_BAD_ACCESS on some devices in ad hoc beta for my app see here: http://stackoverflow.com/questions/2024266/help-debugging-iphone-app-excbadaccess I have managed to use atos -arch armv6 -o myapp.app/myapp 0x000037a6 in terminal to track down the method that's causing this problem, and it's lead me to this piece of...

Why do most spreadsheets contain a hard-coded limit on the number of rows and columns?

Why are programs like Microsoft Excel, Gnumeric and OpenOffice.org Calc designed with hard-coded limits on the number of rows and columns? This seems like an archaic programming technique from when spreadsheets were considered a demanding application and dynamic memory allocation was considered "high-end". I would guess that it indicat...

Performance btw. Stack-Heap Dynamic Arrays

In programming languages concept, Sebesta's book states that (Ninth ed., 284): The disadvantage of fixed heap-dynamic arrays is that they take longer time to allocate array from stack. How can we analyze this statement? What is the difference between fixed heap-dynamic and heap-dynamic arrays. What does that fixed word stand for? ...

Advice on solving OutOfMemoryExceptions for CF

My CF application has a very customized UI, using lots of images as UI elements. The UI feels a lot more smooth when these bitmaps are kept in memory. When they're loaded on demand, the UI is slow and I can see the buttons appearing one by one, which looks very poor. For a long time this went pretty well, but recently I've found the appl...

Possible Memory Leak?

I've got a running java webapp, that I'm monitoring with visualVM. Here's the graph of the heap: The was tested with two sets of requests, one at 3:20 and the other at 4:40 aprox (they are represented in the graph as the only two peaks). My question is: does this means I have a memory leak? I'm worried about the middle part where, a...

View being released when in use due to memory warnings

I've posted a couple of questions before, trying to work out why I'm getting a EXC_BAD_ACCESS, and I've done a bit of debugging See here: http://stackoverflow.com/questions/2024266/help-debugging-iphone-app-excbadaccess/2024391#2024391 and: http://stackoverflow.com/questions/2024654/overreleasing-here So, I think I've discovered what...

Can memory be cleaned up?

I am working in Delphi 5 (with FastMM installed) on a Win32 project, and have recently been trying to drastically reduce the memory usage in this application. So far, I have cut the usage nearly in half, but noticed something when working on a separate task. When I minimized the application, the memory usage shrunk from 45 megs down to...

Memory management in Objective-C and setting pointers to nil

Will the pointer to an object go to nil when its count goes to 0 or when dealloc is called? Why or why not? ...

Adding and removing controls and memory usage in WindowsForm

I have a WindowsForm with a panel control which I use to display my UserControls. I add controls this way: private void AddControl(Control control) { panel.Controls.Clear(); control.Size = new Size(panel.Width - 1, panel.Height - 1); control.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles...

Can you alloc an object whose parent class uses the autorelease pool?

I have a subclass that i use alloc and init to instantiate. In the init method I go self = [self initWithRect:spriteManager.imageRect spriteManager:spriteManager.manager]; So the parent constructor is using the autorelease pool. So what happens here? If I try to release the object I get an error. Should I change my init method to...

Is Foo* f = new Foo good C++ code

Reading through an old C++ Journal I had, I noticed something. One of the articles asserted that Foo *f = new Foo(); was nearly unacceptable professional C++ code by and large, and an automatic memory management solution was appropriate. Is this so? edit: rephrased: is direct memory management unacceptable for new C++ code, in gener...

Objective-C NSThread ref counting convention (retain vs autorelease)

My main program spawns a thread, which executes the following: // alloc autorelease pool somewhere before NSArray *blah = [NSArray arrayWithObject: @"moo"]; [self performSelectorOnMainThread: @selector(boonk:) withObject: blah waitUntilDone: NO]; // release autorelease pool somewhere after Now, this seems buggy to me because the...

When do I use xdata?

I am new at embedded system programming. I am working on a device that uses an 8051 chipset. I have noticed in the sample programs that when defining variables, sometimes they use the keyword xdata. like this... static unsigned char xdata PatternSize; while other times the xdata keyword is omitted. My understanding is that the xdata k...

Objective C /iPhone : Is it possible to re initialize an NSArray?

I read that non mutable data types can't be modified once created.(eg NSString or NSArray). But can they be re-initialized to point to a different set of objects? If so, do I use release to free any alloc from first time round in between uses? eg: myArray declared as NSArray *myArray in interface, and as nonatomic/retain property.myA...

Java & memory management

Dear StackOverflow, I'm new to java world from C++ background. I'd like to port some C++ code to Java. The code uses Sparse vectors: struct Feature{ int index; double value; }; typedef std::vector<Feature> featvec_t; As I understood, if one makes an object, there will be some overhead on memory usage. So naive implementation of Fea...

Under Windows CE, how can I check which RAM based DLLs are loaded in virtual memory space?

I have a problem with loading a DLL under Windows Mobile 5.0. I'm pretty confident that this is caused by running out of the application virtual memory (the 32 MB slot of the process, as explained in Windows CE .NET Advanced Memory Management). I'm looking for a way to actually make sure that this is the issue and investigate whether m...

NSXMLParser ownership on data

Hi, I init my NSXMLParser with a mutable data, that I get from the internet. I wonder whether the parser releases it on its deallocation or I have to release it after the parsing? Thanks ...