memory

Strategies for the diagnosis of Java memory issues

Hello, I've been tasked with debugging a Java (J2SE) application which after some period of activity begins to throw OutOfMemory exceptions. I am new to Java, but have programming experience. I'm interested in getting your opinions on what a good approach to diagnosing a problem like this might be? This far I've employed JConsole to ...

Finding and using memory offsets in an existing program?

Most game botting applications use a series of memory offsets they have found for that particular version of a game client to facilitate botting. They might have a memory offset for health, x/y position, etc. Every time the game releases an update the offsets for the various pieces of information the bot program uses must be re-found a...

How to Test for Memory Leaks?

We have an application with hundreds of possible user actions, and think about how enhancing memory leak testing. Currently, here's the way it happens: When manually testing the software, if it appears that our application consumes too much memory, we use a memory tool, find the cause and fix it. It's a rather slow and not efficient pro...

Running unexported .dll functions with python

Hello! This may seem like a weird question, but I would like to know how I can run a function in a .dll from a memory 'signature'. I don't understand much about how it actually works, but I needed it badly. Its a way of running unexported functions from within a .dll, if you know the memory signature and adress of it. For example, I have...

Memory Allocation in Recursive C++ Calls

Hi, I'm having problems allocating and deallocating my memory in a recursive C++ program. So without using an automatic memory management solution, I wonder if anyone can help me resolve the memory leak I am experiencing. The following code essentially explains the problem (although it's a contrived example, please correct any mistakes...

Is this dynamic memory allocation?

Simple question: do I have to 'delete' or 'delete []' c? Does the language matter? char c[] = "hello" ...

Since I can't return a local variable, what's the best way to return a string from a C or C++ function?

As a follow-up to this question: From what I've seen, this should work as expected: void greet(){ char c[] = "Hello"; greetWith(c); return; } but this will cause undefined behavior: char *greet(){ char c[] = "Hello"; return c; } If I'm right, what's the best way to fix the second greet function? In an embedded environme...

How much memory does a C#/.NET object use?

I'm developing an application which currently have hundreds of objects created. Is it possible to determine (or approximate) the memory allocated by an object (class instance)? ...

Why does std::auto_ptr operator = trash objects?

Seem to be having an issue with std::auto_ptr and assignment, such that the object referenced seems to get trashed for some reason. std::auto_ptr<AClass> someVar = new AClass(); // should work, but mangles content std::auto_ptr<AClass> someVar( new AClass() ); // works fine. std::auto_ptr<AClass> someVar = std::auto_ptr<AClass>(new ACl...

Report Direct3D memory usage

I have a Direct3D 9 application and I would like to monitor the memory usage. Is there a tool to know how much system and video memory is used by Direct3D? Ideally, it would also report how much is allocated for textures, vertex buffers, index buffers... ...

How do C and C++ store large objects on the stack?

I am trying to figure out how C and C++ store large objects on the stack. Usually, the stack is the size of an integer, so I don't understand how larger objects are stored there. Do they simply take up multiple stack "slots"? ...

"stringWithString" vs "alloc ... initWithString ... autorelease" in Cocoa Objective-C.

I've seen it claimed that the following are "pretty much equivalent": foo([NSString stringWithString:@"blah"]) # version 1 foo([[[NSString alloc] initWithString:@"blah"] autorelease]) # version 2 Are the above in fact literally equivalent or are there any subtle differences? What are reasons to prefer one or th...

Returning a pointer to memory allocated within a function in Cocoa Objective-C.

In C, something like the following would be a disaster (ie, a memory leak) because you're returning a pointer to memory that you will never be able to free: NSString* foo() { return [NSString stringWithFormat:@"%i+%i=%i", 2, 2, 2+2]; } Is that in fact totally fine in Objective-C since the memory that the returned pointer points to w...

C++ Parameter's Value Changes Between Stack Frames in std::vector

I've run into a really strange bug, that I'm hoping someone can explain. I have a simple std::vector<V3x>, where V3x is a 3d vector (the linear algebra kind.) The following code causes a std::length_error exception to be thrown: std::vector<V3x> vertices; int vertexCount = computeVertexCount(); vertices.resize(vertexCount); // throws st...

Performance counter for "Largest free region"?

I'm debugging an out-of-memory exception. When I get the exception, the "virtual bytes" performance counter indicates plenty of addressable space. The problem, however, is that the addressable space is badly fragmented, and the "Largest free region" (returned from !address in WinDbg) is too small. To measure the memory fragmentation, ...

JVM heap sizing in VMware guests

This question is probably better phrased: how does running a Java server on a hypervisor such as VMware ESX affect the Java heap? Access to JVM heap is random from the OS/hypervisor perspective It is difficult to for guest OS or hypervisor to optimize memory that is randomly accessed Given this, can the hypervisor detect unused pages i...

What would cause Perl to dump core?

What are the most common reasons that I would be getting this error from running a Perl script: Memory fault(coredump) I am running two SQL commands beforehand that only store ~1500 rows each with 6 fields. The SQL works fine out of the script, so I don't think I'm getting the error from that. And half of my code runs before it takes ...

Is there any way to determine an individual jobs memory consumption on the iSeries?

We have a mixture of .Net apps that connect through ODBC and DB2 Connect to an iSeries LPAR that's at V5R4. We also have some batch jobs running natively on the machine (COBOL, RPG, and straight CL mostly). During certain periods of the day, we experience high page faulting and are trying to determine which apps might be causing the prob...

Why does my c program not free memory as it should?

I have made a program in c and wanted to see, how much memory it uses and noticed, that the memory usage grows while normally using it (at launch time it uses about 250k and now it's at 1.5mb). afaik, I freed all the unused memory and after some time hours, the app uses less memory. Could it be possible, that the freed memory just goes f...

How to get the total allocated memory by an (ASP).NET app programatically ?

How can I check programmatically, how much memory my program currently has allocated ? I need it for an ASP .NET app, but i suspect the solution is general for all types of .NET applications. Ideally, the operation to get the currently allocated amount of memory, should be fast, since I will need to query it often. EDIT: Thanks for you...