memory-allocation

Visual Studio 2010 -- how to reduce its memory footprint

I have a solution with just under 100 projects in it, a mix of C++ and C# (mostly C#). When working in VS2005, the working set of Visual Studio is considerably smaller than that of VS2010. I was wondering if there are some things that can be turned off, so I can develop in VS2010 under 32-bit OS without running out of memory. ...

What is the best way to find a process's memory allocations in terms of C# objects

I have written various C# console based applications, some of them long running some not, which can over time have a large memory foot print. When looking at the windows perofrmance monitor via the task manager, the same question keeps cropping up in my mind; how do I get a break down of the number objects by type that are contributing t...

SSL Provider, error: 0 - Not enough memory is available to complete this request

The other day my ASP.NET application threw an OutOfMemoryException not related to SQL Server. About a minute later, .NET garbage collection kicked in and decreased the memory usage by 50%. The application then started throwing the below exception, but there appeared to be plenty of available Private bytes for the w3wp process. We had ...

TimerCallback.PerformTimerCallback memory allocation

I have a WCF service and I'm profiling its memory allocation. I see that 36% of the memory allocated on each request, is allocated through TimerCallBack.PerformTimerCallback, which in turn calls the following: ExecutionContext.CreateCopy ExecutionContext.Run All these allocation don't even go through my code and only allocates generic ob...

How does free() function collect the info about the no. of bytes to be freed.

Possible Duplicate: C programming : How does free know how much to free? free() is called to deallocate the memory allocated by malloc() function call. From where does the free() find the information about the no. of bytes allocated by the malloc() function. I.e., how do you conform the no. of bytes allocated by the malloc() a...

Reusing NSMutableString correctly on the iPhone

Using objective-c on the iPhone, what is wrong with this code? Is it leaking memory? Why? How would I do this correctly? NSMutableString *result = [NSMutableString stringWithFormat:@"the value is %d", i]; ... then later in my code... I might need to change this to: result = [NSMutableString stringWithFormat:@"the value is now %d", i...

Wrapping C++ dynamic array with Python+ctypes, segfault

Hi! I wanted to wrap a small C++ code allocating an array with ctypes and there is something wrong with storing the address in a c_void_p object. (Note: the pointers are intentionally cast to void*, 'cause later I want to do the allocation the same way for arrays of C++ objects, too.) The C(++) functions to be wrapped: void* test_all...

where pointers and global variables in C are saved in memory, in heap or in stack?

where pointers and global variables in C are saved in memory, in heap or in stack? ...

Why can't I create an object greater than 2GB in size in .NET, even on x64?

After reading Are C# Strings (and other .NET API’s) limited to 2GB in size? I played around with large strings and arrays in .NET 3.5. I found that the largest array I could allocate was int.MaxValue - 56 bytes. Similar thing for strings: the largest I could get was (int.MaxValue - 58) / 2 characters (since each character took 2 bytes). ...

virtual memory allocation

what are my options when i need to allocate virtual memory beyond the limits of system memory? paging file is unlimited(limited by available disk space) so why could not i use it to allocate memory beyond the limits of physical memory limit or OS memory limits? why did they limit the virtual memory with the boundaries of address space? ...

What happens when an iOS device cannot allocate memory? (eg. when it has run out of memory)

If an iOS device cannot successfully [NSObject alloc] (because it is out of memory), will it return nil, throw an exception, or will the OS terminate the app? ...

iPhone: Instruments Allocations increasing steadily

I'm using Instruments with the Allocations instrument. I'm testing only a fixed interaction with my app. I have a navigation controller which goes 4 stages deep. The first two stages are standard table view controllers and the last two are custom controllers with dynamically loaded images. So I run my app in instruments (via Run with...

How to delete a pointer after returning its value inside a function

Hi, I have this function: char* ReadBlock(fstream& stream, int size) { char* memblock; memblock = new char[size]; stream.read(memblock, size); return(memblock); } The function is called every time I have to read bytes from a file. I think it allocates new memory every time I use it but how can I free the memory once I ...

Is there a way to free only a part of the dynamically allocated array in C\C++ (shrink existing array)?

In a program I allocate a huge multidimensional array, do some number-crunching, then only the first part of that array is of further interest and I'd like to free just a part of the array and continue to work with the data in the first part. I tried using realloc, but I am not sure whether this is the correct way, given I must preserve ...

When should I allocate on the heap? (C++)

Hi, I don't really understand when I should be allocating memory on the heap and when I should allocate on the stack. All I really know is that allocating on the stack is faster, but since the stack is smaller I shouldn't use it to allocate large data structures; what other things should I take into account when deciding where to alloc...

JAVA - Out Of Memory Error while writing Excel Cells in jxl

I am using JXL to write an excel file of 50000 rows and 30 columns. My code looks like this: for (int j = 0; j < countOfRows; j++) { myWritableSheet.addCell(new Label(0, j, myResultSet.getString(1), myWritableCellFormat)); myWritableSheet.addCell(new Label(1, j, myResultSet.getString(2), myWritableCellFormat)); ..... ..... } Whil...

double pointer memory allocation

I am currently trying to allocate the same amount of memory for a double pointer. I take in a char** and want to use a bubble sort on that char** . So I create a temp char** and now I'm wondering how to correctly allocate enough memory so that I can return that temp char** to another method. I know the way I'm allocating right now doe...

Is it better to allocate memory in the power of two?

When we use malloc() to allocate memory, should we give the size which is in power of two? Or we just give the exact size that we need? Like //char *ptr= malloc( 200 ); char *ptr= malloc( 256 );//instead of 200 we use 256 If it is better to give size which is in the power of two, what is the reason for that? Why is it better? Thanks...

Windows memory allocation questions.

I am currently looking into malloc() implementation under Windows. But in my research I have stumbled upon things that puzzled me: First, I know that at the API level, windows uses mostly the HeapAlloc() and VirtualAlloc() calls to allocate memory. I gather from here that the Microsoft implementation of malloc() (that which is included ...

How to manage the memory yourself? Unhandled exception at 0x00423e3b in memory_manager.exe: 0xC0000005: Access violation reading location 0x00000004.

Unhandled exception at 0x00423e3b in memory_manager.exe: 0xC0000005: Access violation reading location 0x00000004. Souce file Download: http://www.cppblog.com/Files/mymsdn/memory_manager_bug_vs2008_debug.zip Hey, I am trying create a memory manager function to resolve some problem: reference count the new / delete counter when a...