memory-management

Operations and functions that increase Virtual Bytes

Having some out-of-memory problems with a 32-bit process in Windows I begun using Performance Monitor to log certain counters for that process. Though it is normal that Virtual Bytes is higher than both Private Bytes and Working Set, I found that in my case there was a substantial difference, Virtual Bytes was much higher than both Priv...

Counting memory blocks

This is a homework question from compiler design course. I just need an explanation of certain parts of the question. It is claimed that returning blocks to the standard memory manager would require much administration. Why is it not enough to have a single counter per block, which holds the number of busy records for that bl...

View Controller being sent a message even though it has been deallocated.

I am not sure if something has changed in the iPhone SDK 3.0 but I am getting the strangest error. I have a view controller hierarchy where I switch between view controllers depending upon interface orientation. From what I can tell, the error is caused whenever I rotate the interface a view controller which has been deallocated is being...

Java: flushing memory out to disk

Let's say I have a Java application which does roughly the following: Initialize (takes a long time because this is complicated) Do some stuff quickly Wait idly for a long time (your favorite mechanism here) Go to step 2. Is there a way to encourage or force the JVM to flush its memory out to disk during long periods of idleness? (e....

what is a relocatable executable and why it is needed

What is the use of relocatable executable and how is it generated and how it is used ? what do we mean by processes memory map remapping ? if some can explain me w.r.to embedded systems , it will be great thanks in advance -Das ...

When should I consider using a in memory database and what are the issue to look out for?

I was just think that now it is common to have enough RAM on your database server to cache your complete database why are the specialist in memory database (e.g TimesTen, see also Wikipedia page) that were all the rage a few years ago not being used more? It seems to be that as time go on, none disk based databases are being used less...

Objective-C/iPhone Memory Management Static Variables

I have a static method that creates an instance of the class and puts it in the static variable. I am wondering what the proper way of memory management is in this situation. You can't put it in the dealloc-method, because although it can access the static variable any instance method that is created that get's released will also relea...

a doubt regarding iphone memory management 'release'

- (void)applicationDidFinishLaunching:(UIApplication *)application { // Create the navigation and view controllers RootViewController *rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain]; UINavigationController *aNavigationController = [[UINaviga...

Why does new / malloc fail on Win x64 although there is plenty of free RAM?

I have a strongly recursive function, that creates a (very small) std::multimap locally for each function instance using new (which recurses to malloc/calloc in the std lib). After some hundred recursions new fails although i am using a native 64Bit application on Windows XP x64. The machine has 10 GB RAM, The application only uses about...

More Specific, General Objective-C Memory Management.

Everything i've read about objective-c memory management makes it sound incredible easy. To paraphrase everyone: "release whatever you alloc, retain or copy". But I think there are some more specific cases that are not so clear cut. Below are some sample situations. What is the correct procedure for each: SITUATION #1: Foo *foo = [...

Memory management and realloc

I'm going through my program with valgrind to hunt down memory leaks. Here's one that I'm not sure what to do with. ==15634== 500 (224 direct, 276 indirect) bytes in 2 blocks are definitely lost in loss record 73 of 392 ==15634== at 0x4007070: realloc (vg_replace_malloc.c:429) ==15634== by 0x807D5C2: hash_set_column(HASH*, int, ...

C memory management for Cross-platform VM.

Hi all, I asked a question about C-type sizes which I get a pretty good answer but I realized that I may not formulate the question very well to be useful for my purpose. My background was from Computer Engineer before moves to Software Engineer so I like computer architectures and always thinking about making VM. I've just finished an ...

Making a memory intensive background application "friendly"

I have an application that periodically needs to process large blocks of data with a computationally trivial algorithm. It turns out I can also prevent slowing down the system from hard drive accesses by keeping the blocks of data in a memory cache. The application is a low-priority application so I'm working to minimize its impact on th...

memory mapped files reamain in physical memory

I have a process that uses a lot of memory mapped files. Problem is that those files are kept in physical memory, even when the machine is low on memory, and other processes require this memory. I've tried using SetProcessWorkingSetSize to limit the process working set, but it doesn't help, the process' working set keeps growing over th...

Why use integers smaller than 32bit ?

I always like to use the variable with the smallest size that will work just fine, But would this really gain me if I used short byte integers instead of integer, and the memory is 32bit word addressable, Does the compiler do something to enhance memory usage ? ...

Preventing Windows from paging some data

I have a large block of data in memory that I don't want Windows to page. The memory is a cache of a section of data that can be reconstructed from files on disk. The cache is meant to completely prevent hard drive accesses as long as enough memory is available, so it's worthless to me if Windows starts paging it. Instead of paging, I wo...

is it good form to release self in an init method when that method allocates and returns something else?

In my code, I have something that looks like this: @implementation MyClass - (id) initWithType:(NSInteger)type { [self release]; if (type == 0) { self = [[MyClassSubclass1 alloc] init]; } else { self = [[MyClassSubclass2 alloc] init]; } return self; } //... @end which I think handles any potential memory leaks. Ho...

fixing memory leaks when you're returning the leaked memory?

How do you fix a memory leak where you're returning from the function the leak itself? For example, I make a char* returnMe = new char[24324]; returnMe is what ends up getting returned from the function. How do you account for this memory leak? How do you destroy it once it's been returned? I have some memory management rules in plac...

Dynamic Allocation of Memory

How malloc call managed by user-library. I need the explanation of "How memory is being allocated in user space when malloc is called. Who manage it. Like sbrk() is called to enter in kernel space". ...

Using free inside the destructor of an object freed with delete

I'm having a little issue. I have an object that I'm freeing with delete, and it has a char* that's being freed with free in its destructor. The reason I'm using free is because I used strdup and malloc in creating the char pointers. The reason I'm using malloc is because I used strdup to begin with in most code paths. Would this scenari...