memory

Tools For Limiting Available Memory

OS: Windows XP Does anyone know of tools (preferably free) to limit memory available and also other windows resources (handles etc.)? I want to test an app with low memory to make sure it behaves properly and if there are already tools to do this sort of thing, I'd rather not write my own. By the way, I did look for other Q & A threa...

Memory footprint issues with JAVA, JNI, and C application

I have a piece of an application that is written in C, it spawns a JVM and uses JNI to interact with a Java application. My memory footprint via Process Explorer gets upto 1GB and runs out of memory. Now as far as I know it should be able to get upto 2GB. One thing I believe is that the memory the JVM is using isn't visible in the Pro...

C# - How do you get total amount of RAM the computer has?

I'm wanting to get the total amount of RAM my computer has using C#. Using the PerformanceCounter I can get the amount of Available ram, by setting: counter.CategoryName = "Memory"; counter.Countername = "Available MBytes"; But I can't seem to find a way to get the total amount of memory. How would I go about doing this? Update: Ma...

Stack overflow problem!

You may think that this is a coincidence that the topic of my question is similar to the name of the forum but I actually got here by googling the term "stack overflow". I use the OPNET network simulator in which I program using C. I think I am having a problem with big array sizes. It seems that I am hitting some sort of memory allocat...

How to find the amount of physical memory occupied by a hash in Perl?

I have a Perl script where I maintain a very simple cache using a hash table. I would like to clear the hash once it occupies more than n bytes, to avoid Perl (32-bit) running out of memory and crashing. I can do a check on the number of keys-value pairs: if (scalar keys %cache > $maxSize) { %cache = (); } But is it possible to c...

Memory Management in Objective-C

I come from a C/C++ background and the dynamic nature of ObjectiveC is somewhat foreign to me, is there a good resource anyone can point me to for some basic memory management techniques in ObjectiveC? ex. retaining, releasing, autoreleasing For instance, is it completely illegal to use a pointer to an Objective C object and treat it as...

C pointer assignment behavior

temp2, temp1 are pointers to some struct x: struct FunkyStruct x; struct FunkyStruct *temp1 = &x, *temp2 = &x; Now, after execution of following lines: temp2=temp1; temp1=temp1->nxt; ...Will temp2 and temp1 still point to the same memory location? If not, please explain why they would be different. ...

Object Memory Analysis in .NET

Is there a tool or a way to find out how much memory consumed by each DLL or object in .NET? The more detail it analyzes the better. Thanks. ...

A way to determine a process's "real" memory usage, i.e. private dirty RSS?

Tools like 'ps' and 'top' report various kinds of memory usages, such as the VM size and the Resident Set Size. However, none of those are the "real" memory usage: Program code is shared between multiple instances of the same program. Shared library program code is shared between all processes that use that library. Some apps fork off ...

How do you pre allocate memory to a process in solaris?

My problem is: I have a perl script which uses lot of memory (expected behaviour because of caching). But, I noticed that the more I do caching, slower it gets and the process spends most of the time in sleep mode. I thought pre-allocating memory to the process might speed up the performance. Does someone have any ideas here? Update:...

Linux: How to measure actual memory usage of an application or process?

Hi, How do you measure the memory usage of an application or process in Linux? I've read here that "ps" is not an accurate tool to use for this intent. Thanks, Kenneth ...

How to read file content into istringstream?

In order to improve performance reading from a file, I'm trying to read the entire content of a big (several MB) file into memory and then use a istringstream to access the information. My question is, which is the best way to read this information and "import it" into the string stream? A problem with this approach (see bellow) is that...

How to preserve stack space with good design?

I'm programming in C for RAM limited embedded microcontroller with RTOS. I regularly break my code to short functions, but every function calling require to more stack memory. Every task needs his stack, and this is one of the significant memory consumers in the project. Is there an alternative to keep the code well organized and reada...

What happens when you try to free() already freed memory in c?

For example: char * myString = malloc(sizeof(char)*STRING_BUFFER_SIZE); free(myString); free(myString); Are there any adverse side effects of doing this? ...

difference in speed between char and integer arrays?

Hello all, currently I'm dealing with a video processing software in which the picture data (8bit signed and unsigned) is stored in arrays of 16-aligned integers allocated as __declspec(align(16)) int *pData = (__declspec(align(16)) int *)_mm_malloc(width*height*sizeof(int),16); Generally, wouldn't it enable faster reading and writing...

Faster Directory Walk with VB6 Query: Cache and Ram issues?

Below is a rather simple function which counts how many files are on a machine. Called on "C:\", it takes about 5 seconds to run. Unless I haven't run it in a while or first run a ram-clearing program, in which case it takes 60 seconds or more. I wouldn't have thought it could be caching since I'm doing a new scan each time (i.e. star...

How much memory do Enums take?

For example if I have an Enum with two cases, does it make take more memory than a boolean? Languages: Java, C++ ...

Is Lambda Probe dead?

Does anyone know where to get the source code for LambdaProbe? Alternatively, does anyone know if the project could be moved to a community repository? Besides the tool not being updated for over a year, the LambdaProbe website has been down since late September 2008. Background: Lambda Probe is a useful tool for viewing stats on a ...

Why do discussions of "swappiness" act like information can only be in one place at a time?

I've been reading up on Linux's "swappiness" tuneable, which controls how aggressive the kernel is about swapping applications' memory to disk when they're not being used. If you Google the term, you get a lot of pages like this discussing the pros and cons. In a nutshell, the argument goes like this: If your swappiness is too low, i...

Multithreaded Memory Allocators for C/C++

Hi I currently have heavily multithreaded server application, and I'm shopping around for a good multithreaded memory allocator. So far I'm torn between: -Sun's umem -Google's tcmalloc -Intel's threading building blocks allocator -Emery Berger's hoard From what I've found hoard might be the fastest, but I hadn't heard of it before ...