memory-management

C# Marshal class available on Xbox?

does anyone know if the Marshal class is available on the xbox360, specifically the AllocHGlobal method. Unfortunately I don't have access to an xbox right now, otherwise I would test it myself! Basically I want to be able to allocate unmanaged memory myself, ie. this piece of code should work: IntPtr ptr = Marshal.AllocHGlobal(10000)...

Should I call GC.Collect immediately after using the large object heap to prevent fragmentation

My application does a good deal of binary serialization and compression of large objects. Uncompressed the serialized dataset is about 14 MB. Compressed it is arround 1.5 MB. I find that whenever I call the serialize method on my dataset my large object heap performance counter jumps up from under 1 MB to about 90 MB. I also know that un...

Free unmanaged memory allocation from managed code

Hi! A .NET application calls C dll. The C code allocates memory for a char array and returns this array as result. The .NET applications gets this result as a string. The C code: extern "C" __declspec(dllexport) char* __cdecl Run() { char* result = (char*)malloc(100 * sizeof(char)); // fill the array with data return resul...

FastShareMem still necessary in Delphi-2010?

Hi, Up until now I am developing using Delphi 7. In order to pass f.e. TStringLists to my DLL's I use the FastShareMem unit as first unit in every program and dll I develop. If I should migrate to Delphi-2010, Does FastShareMem still necessary ? Thanks for any insight you may provide. ...

Is it normal that my Grails application is using more than 200 MB memory at startup?

My Grails application is running in a development environment. I still didn't go into production, but in any case, is it normal that my Grails application is requiring 230 MB at startup only (with an empty bootstrap and no request handled so far)? Do you know why this is the case, how to improve memory usage in development mode and, mos...

Methodology for saving values over time

I have a task, which I know how to code (in C#), but I know a simple implementation will not meet ALL my needs. So, I am looking for tricks which might meet ALL my needs. I am writing a simulation involving N number of entities interacting over time. N will start at around 30 and move in to many thousands. a. The number of entities ...

Memory Management and ZipArchive class in PHP

I have a PHP script that uses adds a lot of small files into the same zip arhchive file using PHP's ZipArchive class. Recently script started to run out of memory, although the archive is large, but I add only small files one by one, safely re-opening archive each time I need to add a file. The initial archive file grew little by littl...

How to debug Core Data crash on fetch request

Hi guys, the second time I execute [[MOC executeFetchRequest:request error:&error] lastObject]; after having said NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:[NSEntityDescription entityForName:@"Login" inManagedObjectContext:MOC]]; NSError *error = nil; it crashes with a EXC_BAD_ACCESS. Included is...

What could this curious combination of "while" and "delete" mean?

Reviewing a quite old project I found the following curious code snippet (only relevant code extracted): class CCuriousClass { ~CCuriousClass(); CSomeType* object; }; CCuriousClass::~CCuriousClass() { while( object != NULL ) { delete object; } } Have I overseen anything or is it a plain road to undefined behav...

C++: auto_ptr + forward decleration?

I have a class like this: class Inner; class Cont { public: Cont(); virtual ~Cont(); private: Inner* m_inner; }; in the .cpp, the constructor creates an instance of Inner with new and the destructor deletes it. This is working pretty well. Now I want to change this code to use auto_ptr so I write: class Inner; class Con...

Heap / Stack and multiple processes

Hi, Say I have two process p1,p2 runnning as a part of my application. Say p1 is running initially executing function f1() and then f1() calls f2().With the invocation of f2() process p2 starts excuting What I want to confirm is it that :- 1)Do we have seperate stack for different process? 2)Do we have seperate heap for different proc...

Role/Responsibility of Heap Manager

Hi, Is heap manager the one responsible to manage the virtual memory allocations of heap [per process] to the actual mapping of these virtual memory fragments[allocated for heap] to the actual physical memory? If possible please point me to some documentation on relation of heap and virtual memory/actual memory mapping. Thanks. ...

Instantiating objects in shared memory C++

We have a need for multiple programs to call functions in a common library. The library functions access and update a common global memory. Each program’s function calls need to see this common global memory. That is one function call needs to see the updates of any prior function call even if called from another program. For compatibili...

Efficient realtime SVG entity management with javascript

[edit]sigh... the "spam protection" here isn't letting me post the links, so I guess it's URIs instead[/edit] [edit2]ok, BROKEN forms of the URI that can get past the regexp...[/edit2] I'll preface this by saying I'm totally new to SVG, and somewhat new to Javascript, having come from a background in low-level C. On a whim, though, I de...

32 bit OS , 32 bit processor what do they exactly mean

Whats is the exact meaning of 32 bit OS , 32 bit processor? Does it influence the size of address bus? Does it influence the number of virtual address that can be generated? How will it affect the register size means does the register size? What impact it has on virtual memory/ memory management I am a begineer in this area please po...

What is nothrow delete in C++?

This MSDN page mentions that there're nothrow versions of new and delete. nothrow new is quite a known thing - returns null instead of throwing an exception if memory allocation fails. But what is nothrow delete mentioned there? ...

When should I use malloc in C and when don't I?

I understand how malloc() works. My question is, I'll see things like this: #define A_MEGABYTE (1024 * 1024) char *some_memory; size_t size_to_allocate = A_MEGABYTE; some_memory = (char *)malloc(size_to_allocate); sprintf(some_memory, "Hello World"); printf("%s\n", some_memory); free(some_memory); I omitted error checking for the sak...

Retain count of navigationcontroller and window is 3

I am developing an iPhone application which is navigation based. Whenever the application quits, the retain count of the navigation controller and the window is 3. Can somebody explain me how to overcome this issue? The dealloc method, as a result, is not getting called. ...

When should a C function return newly allocated memory?

In a response elsewhere, I found the following snippet: In general it is nicer in C to have the caller allocate memory, not the callee - hence why strcpy is a "nicer" function, in my opinion, than strdup. I can see how this is a valid pattern, but why might it be considered nicer? Are there advantages to following this patter...

Enabling the NSCopying protocol in a class

I have a class that has been derived from NSObject. How can copy be enabled like [object copy]? This is for an iPhone application. ...