memory

Force garbage collection/compaction with malloc().

I have a C++ program that benchmarks various algorithms on input arrays of different length. It looks more or less like this: # (1) for k in range(4..20): # (2) input = generate 2**k random points for variant in variants: benchmark the following call run variant on input array # (3) Is it possible to reset the whole he...

Can the "Application Error" dialog box be disabled?

I am using Hudson as a continuous integration server to test C/C++ code. Unfortunatly, I have a bug somewhere that causes memory corruption, so on some Windows machines I will sometimes get a "Application Error" dialog box explaining that an instruction referenced memory that could not be read. This dialog box pops up and basically han...

Problems closing tabs

I've a WPF app organized with tabs. I added a small button to each tabitem header that allow the user to close the tab. When the user click on the small button, I remove the tabItem from the tabControl. tabControl.Items.Remove(tabItem); As result of this the tabItem dissapears, and that is fine, but here comes the problem: The TabIt...

IIS 6.0 app pool sharing DLLs

I have 10+ apps that are on a single app pool. All these apps have some common dlls that they all load. The issue right now is that these dlls are put in the '\bin' folder for each app. So each app; even though it uses dll_a, will end up loading its own 'copy' of dll_a. I have a few questions 1) Is this ok? 2) Should i put dll_a in so...

Can Someone explain the Marshal.StructureToPtr

I'm having some trouble with this code: //Creating a new ImageElement Struct ImageElement oElement = new UM0516.ImageElement(); //Create a pointer and allocate enough room for the struct type IntPtr pElement = Marshal.AllocHGlobal(Marshal.SizeOf(new UM0516.ImageElement())); //Copy the contents of the struct into the allocated memory spa...

Define smallest possible datatype in c++ that can hold six values

I want to define my own datatype that can hold a single one of six possible values in order to learn more about memory management in c++. In numbers, I want to be able to hold 0 through 5. Binary, It would suffice with three bits (101=5), although some (6 and 7) wont be used. The datatype should also consume as little memory as possible....

How to avoid running out of memory in high memory usage application? C / C++

I have written a converter that takes openstreetmap xml files and converts them to a binary runtime rendering format that is typically about 10% of the original size. Input file sizes are typically 3gb and larger. The input files are not loaded into memory all at once, but streamed as points and polys are collected, then a bsp is run on ...

When Apple talks about "Memory", what do they mean?

For my understanding there are always two types of memory: the working storage the "disk space" So when you have a 16 GB iPhone, does it have 16 GB of working storage? or 16 GB of "disk space"? Which "Memory" is Apple talking about in his Docs, when it comes to performance and memory management? It looks like the working storage, but...

Tools to identify memory hogs in VB6 applications

What tools are available to attribute memory consumptions in VB6 application to it's multiple components? I can get the memory consumed by the entire application by watching various counters (Private Bytes, Working Set etc.), for example, in Process Explorer. I want to go level deeper than that and understand how much memory is consumed ...

Arrays in Objective-C main method. Sigserve errors. Newb.

In Objective-C how should I best approximate what in Java I am doing like this: static private String[] array {"A", "B", "C"}; What I think I need is a simple array that I can index into with some integers. Alternative suggestions are welcome, but bear in mind that if I am getting stuck on this then I am pretty much hopeless anyway...

Is there an alternative way to free dynamically allocated memory in C - not using the free() function?

I am studying for a test, and I was wondering if any of these are equivalent to free(ptr): malloc(NULL); calloc(ptr); realloc(NULL, ptr); calloc(ptr, 0); realloc(ptr, 0); From what I understand, none of these will work because the free() function actually tells C that the memory after ptr is available again for it to use....

iphone hierarchical TableView memory never released

Hello, in the very good book "Beginning iPhone Development" (Apress), in the Chapter 9, they explain how to build an application with a navigation controller and hierarchical table views. If you launch the application with Instrument/Activity monitor, the application working well but with a big problem : each time you drill down from tab...

Releasing NSData causes exception...

Hi, Can someone please explain why the following code causes my app to bomb? NSData *myImage = UIImagePNGRepresentation(imageView.image); : [myImage release]; If I comment out the 'release' line, the app runs... but a few times calling the function containing this code and I get a crash - I guess caused by a memory leak. Even if I...

Memory usage in C#

I have a program that uses threads in C#. Is there a way to know programmatically the memory usage of the application? I want to limit the spawning of threads to say 10 megabytes of memory, how would I do that? ...

Are Delphi strings immutable?

As far as I know, strings are immutable in Delphi. I kind of understand that means if you do: string1 := 'Hello'; string1 := string1 + " World"; first string is destroyed and you get a reference to a new string "Hello World". But what happens if you have the same string in different places around your code? I have a string hash assi...

What's the relationship between "a" heap and "the" heap?

A heap is a tree data structure where higher levels of the tree always contain greater (or lesser, if it's set up that way) values than lower levels. "The" heap is a bunch of free RAM that a program has available for dynamic allocation. They're both called "heap," but what does the one have to do with the other? ...

Best way to profile memory usage in a Java application?

I realize that similar questions have been asked about this before here on SO, but let me describe exactly what I need to do: I have a set of tests which run a command line java application and I'd like to add memory profiling to them. One option I see would be to add code (possibly using 3rd party tools/libraries) to my application th...

Allowed memory size exhausted during non-PHP MySQL import.

When I try to import a large SQL backup using the command: mysql -u ***** -p***** nxtpp < backup.sql I get the following error message after the backup is partially executed: Allowed memory size of 33554432 bytes exhausted I already know about the memory_limit variable in php.ini, but the problem is that I am not using PHP to impor...

Is Serialization reliable for object size estimation?

Hi, I use serialization, in order to estimate the amount of memory used for an object. I already read this, and this. So I know that it may be better to use a profiler or sizeof (for value types). I would like to know, what is the exact difference between the serialized object and the object in memory ? In what measure is serialization ...

GDB: Getting a symbol name from a memory address

I'm not sure if the following is possible, but can one retrieve the name of a symbol that a memory address points to in GDB? For instance, I know that 0x46767f0 belongs to an NSString*, is there any way I can find out what NSString it is to help me find some bugs I'm after? Thanks! ...