memory-management

Crash when releasing object created using initFromFile method

Hi - I've created an object called 'DateTracker' which conforms to NSCoding, so it contains encodeWithCoder and initWithCoder methods. When I initialise it, I call the following: DateTracker *currentTracker = [[DateTracker alloc] initFromFile]; The initFromFile method looks like this: - (id)initFromFile { NSString *filePath = [s...

Running R jobs on a grid computing environment

I am running some large regression models in R in a grid computing environment. As far as I know, the grid just gives me more memory and faster processors, so I think this question would also apply for those who are using R on a powerful computer. The regression models I am running have lots of observations, and several factor variable...

Yet Another IPhone Memory Management Question

So say I'm getting results from my core data request: (this is example code) On a button press event it does: NSMutableArray *results = [[myContext executeFetchRequest:request error:&error] mutableCopy]; myObject = (MyObject *)[mutableFetchResults1 objectAtIndex:0]; // assume that there's something in there Now I want myObject to sti...

Received memory warning in modal view -- parent view controller's objects get released. How to prevent?

My root view controller is a map with several annotations. When an annotation is selected and the accessory button is tapped, I display a modal view that looks like so: http://i.imgur.com/hACyH.png In this modal view, you can get a street view look at the annotations coordinate (I do this using a UIWebview). You can also submit a phot...

To the bottom with didRecieveMemoryWarning

I have to go to the bottom with the didRecieveMemoryWarning method. I have read like thirty threads about this topic on this forum. And every answer is differerent. First question. Should you release objects in didRecieveMemoryWarning or just set them to nil? Or both? I have read that I should release the tableView data source, if you ...

Stop drawing of CATiledLayer

Is is possible to stop CATiledLayer to draw (drawLayer:inContext)? It draws asynchronously and when i try to release CGPDFDocumentRef, which is used by CATiledLayer, the app crashes (EXC_BAD_ACCESS). That's my view: @implementation TiledPDFView - (id)initWithFrame:(CGRect)frame andScale:(CGFloat)scale{ if ((self = [super initWithF...

Problem with Memory Management in Android image processing with http protocol.

Hi friends, I have a problem with a memory management. I'm downloading some data through mine HTTP client. Next thing I want to display data to the user. The problem is not stable, on some files of the same type it occurs, on some not. Stable thing is, that it is occurring on the same file. Here is LogCat input. Technically I have no...

SBJsonParser: App crashes if I do not retain the return value

I create/push my ViewController, display some informations and navigate back to my RootViewController. While I navigate back the app crashes (EXC_BAD_ACCESS). With Instruments I found out that the dealloc of my ViewController is called, which releases my wrapper class. In my wrapper class also the dealloc method is called. This dealloc ...

Memory management - how best to initialise an instance declared in the header

I've read a few posts on this, but there's still one thing that's not clear for me. I know this might be rather a n00b question, but I've actually got rather far into development without quite grasping this fundamental issue. A symptom of being self taught I guess. You declare a variable in your header, like so: @interface SomeClass ...

Canonical example of stack destruction in a C program

Hi, could someone please teach me a common example whereby (!) you destroy the stack in a C program? I use GCC, in Ubuntu. Thanks. ...

Reducing the memory footprint of a function with a lot of autoreleased variables?

Hi, I'm still wrapping my head around some of the nuances of memory management in objective-C, and came up with the following case I'm unsure about: + (NSDecimalNumber*)factorial: (NSDecimalNumber *)l { NSDecimalNumber *index = l; NSDecimalNumber *running = [NSDecimalNumber one]; for (; [index intValue] > 1; index = [inde...

Memory management bottleneck to SMP Parallelism

Across multiple languages (mostly D and Java/Jython) I've noticed that parallel programs with no obvious synchronization bottleneck often don't scale well to 4 or more cores because of memory management bottlenecks. I'm aware that thread-local allocators mitigate this problem, but most garbage collector implementations still need to sto...

How to find how much space is allocated by a call to malloc()?

I'm trying to write a size function like this: size(void *p,int size); Which would return the size of an array which is pointed to by p. For example: Int *a = malloc((sizeof(int)*100)); size(a,sizeof(int)); // this should return 100 I think this is possible because if I recall, malloc keeps track of the space allocated in some head...

ipad: Image loading and Memory management problem & crash of the app

hi all. I am having about 60 different images coming from the webservice.And I am storing it in a NSMutablearray. now when I load the image for the very first time , each image will consume about 0.5 to 1.5 mb of space of iPad. As I do have multiple images the memory consumption reaches very high and then application gets crashed. I a...

What is meant by statically relocated or static relocation of a segment

The elf format executable contains various segments like code, data, bss, stack etc. If we say that the segment xyz is statically relocated what does that mean? The elf format binary contains relative addresses for each segment. When we say statically relocated does it mean that the relative addresses are actually the physical addresses...

(C++) Looking for tips to reduce memory usage

Hi, I've got a problem with a really tight and tough memory limit. I'm a CPP geek and I want to reduce my memory usage. Please give me some tips. One of my friends recommended to take functions inside my structs out of them. for example instead of using: struct node{ int f() {} } he recommended me to use: int f(node x) {} ...

Is it better to preload all the sound files before the start of the game?

Hi, I am building a game with 20 levels and have around 15 music files. Currently I am preloading all the 15 sounds using cocos denshion at the start of the game. However the game crashes after a few levels. I get a 'Program received signal: “0”. Data Formatters temporarily unavailable' error. I assume this is because of lack of memory ...

Apple Memory Management Programming Guide / Hard example...

Hi, As many objc developers, I ended-up reading and reading again the Apple Memory Management Programming Guide, because that's the best way to understand retain/release/autorelease mechanisms. In this page, there is really an example I do not understand: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgm...

Can I walk through my process' page table in userspace?

Hello, Can anyone suggest some learning materials to accomplish my question? I'm working with the Linux kernel. I'm planning on conducting an experiment, but need access to my process' page table, and so far have only found kernel space code to accomplish what I want. Thanks ...

Duplicate Visual Studio's memory violation detection on Linux

I developed a command-line (non GUI) C program on Linux using QT Creator, which internally uses gdb as its debugger. When I debugged the program on Windows using Visual Studio, it reported that it was writing outside the bounds of allocated memory (although it did not report the violation at the exact time it occurred, so it was still h...