memory

WPF out of memory exception when loading large amount of bitmaps in single instance of app. Is there a limit?

I need to load large amounts of bitmaps into memory for display in a WPF app (using .net 4.0). Where I run into trouble is when I approach around 1,400MB of memory ( I am getting this from the process list in the task manager). This same thing happens whether the app is run on a machine with 4GB of memory or 6GB (and some other configs...

How can I reserve memory addresses without allocating them.

Hello. I would like (in *nix) to allocate a large, contigious address space, but without consuming resources straight away, i.e. I want to reserve an address range an allocate from it later. Suppose I do foo=malloc(3*1024*1024*1024) to allocate 3G, but on a 1G computer with 1G of swap file. It will fail, right? What I want to do is sa...

Memory management question

Hello all, I wanted to clarify something: I.e when I add a UIVIEW To i.e another UIVIEW programatically. i.e [theview addsubview:thechildview]; I need to release thechildview because theview increments the retain count. Right? So basically if I have a loop and I am using that loop to initialise subviews and add the subviews to a vie...

Does tuning the GC help?

Possible Duplicate: Has anyone found Garbage Collection tuning to be useful? Does it really help? Isn't the jvm written by much smarter people? What will be case to tune it manually? ...

Custom memory allocator/manager in C ? which approach?

I looking for some (custom) memory managers/allocator written in c and went through some articles, - Some Links : IBM - Inside memory management Valgrind - How to Shadow Every Byte of Memory Used by a Program Stack Overflow Question - Write your own memory manager ned Productions - nedmalloc Homepage Two-Level Segregate Fit (TLSF) - W...

What is the purpose of each of the memory locations, stack, heap, etc? (lost in technicalities)

Ok, I asked the difference between Stackoverflow and bufferoverflow yesterday and almost getting voted down to oblivion and no new information. So it got me thinking and I decided to rephrase my question in the hopes that I get reply which actually solves my issue. So here goes nothing... =) I am aware of four memory segments(correct ...

IPhone Leaking Memory in tight loop

Hi all, I'm having a problem with my memory footage, it keeps on increasing even though I have properly released the objects in tight loop. The app will crash with "out of memory error" after some time... I've drilled down the problem to this: /******************** Begin SimpleObject ***********/ //@interface SimpleObject : NSObject { ...

Array not crossing 256 byte boundary

Is it possible to create an array that doesn't cross 256 byte boundary? That is addresses of the individual array items only differ in the lower byte. This is weaker requirement than keeping the array aligned to 256 bytes. The only solution I could think of was aligning to next_power_of_two(sizeof(array)), but I'm not sure about the gaps...

How do cache lines work ?

I understand that the processor brings data into the cache via cache lines, which - for instance, on my atom processor - bring in about 64 bytes at a time, whatever the size of the actual data being read. My question is : Imagine that you need to read one byte from memory, which 64 bytes will be brought into the cache ? The two possib...

Android : On application exit?

Hi, I understand when an activity closes, onDestroy() is called. But this is not done always right? Sometimes, onPause() is called. So suppose I want to clear some memory when an activity closes, where exactly do I do it? Since onDestory may not be called, I cannot keep it there either right? Elaborating: I have 2 activities A1 and A2...

Is there any physical part of memory with the address of NULL(0) ?

I know there's an old saying when you want to indicate this specific pointer doesn't point to anything it should be set to NULL(actually 0), but I'm wondering isn't there actually a physical part of memory with the address of NULL(0) ? ...

how to safely delete multiple pointers

I have got some code which uses a lot of pointers pointing to the same address. Given a equivalent simple example: int *p = new int(1); int *q = p; int *r = q; delete r; r = NULL; // ok // delete q; q = NULL; // NOT ok // delete p; p = NULL; // NOT ok How to safely delete it without multiple delete? This is especially difficult if I...

How to initialize a pointer to a specific memory address in C++

Possible Duplicate: pointer to a specific fixed address An interesting discussion about this started here but no one have been able to provide the C++ way of doing: #include <stdio.h> int main(void) { int* address = (int *)0x604769; printf("Memory address is: 0x%p\n", address); *address = 0xdead; printf("Content o...

java process on windows using less memory than specified in -xms?

I'm starting my server with "java -xms 1280m -xmx 1280m" command. On Linux machines, this works fine and I see the process using almost the same amount of memory. On Windows machines, however, I see the java process using much less than 1280m - around 500-600m. I gathered this data from the windows task manager, if that matters. The two ...

Memory and pointers

Hi I have need some some help with some thinking around a task. My task is to create one memory area void *memory = malloc(320); and then use pointers to store texts into this storage place: We want to divide this area into data blocks of 32 bytes, sow we can store: 320/32 = 10 data blocks a 32 bytes. Into one data block I can store...

Texture/Geometry Memory Availability

Suppose a discrete video card has N megabytes of gpu ram. Typically how much of that is usable as texture/geometry memory? ...

How to get internal/external available space in Android Application?

Hello all, I'm writing an android program to check available space of internal phone memory or external sd card. But i don't know how to do this. Any one can help me how to do it in Android? ...

multiple C++ deletion of a memory pointed by multiple objects

Another c++ pointer deletion question is in the following example: class Foo { public: int *p; ~Foo() { delete p; p = NULL; } }; Foo *f1 = new Foo(); Foo *f2 = new Foo(); f1->p = new int(1); f2->p = f1->p; delete f2; // ok delete f1; // no error? Why I did not get error when calling "delete f1"? didn't I delete th...

How to release object passed to protocol or delegate method in Objective-c?

How and when is released IndexPath object which is returned in UITableViewDelegate? let's imagine code: //my method in my object { NSNumber *number=[[NSNumber alloc] init]; number=[[self methodreturningnumber] retain]; [delegate didSelectItemAtIndex:number]; } in my delegate I have method: -(void)didSelectItemAtIndex:(N...

Memory consuption code optimization, a garbage collector question

In my WPF-application I call new windows in the following way: _newWin = new WinWorkers_AddWorker(); _newWin.WindowState = this.WindowState; _newWin.Show(); Where _newWin is a private Window object. My question is should I assign a null value to _newWin after I call _newWin.Show()? Will this decrease memory consumption, because garb...