memory

vector assignation on uninitialized memory chunk and similar issues

vector<vector<string> > test for example. g++, you can do test.reserve(10); test[0] = othervector; test[9] = othervector; It doesn't crash. Theory says you shouldn't do it like that because you are assigning a vector to a chunk of memory that believes it is a vector. But it works just like the next one: #include <string> #include <...

How to convert bytes to megabytes

I've seen three ways of doing conversion from bytes to megabytes: megabytes=bytes/1000000 megabytes=bytes/1024/1024 megabytes=bytes/1024/1000 Ok, I think #3 is totally wrong but I have seen it. I think #2 is right, but I am looking for some respected authority (like W3C, ISO, NIST, etc) to clarify which megabyte is a true megabyte. ...

Due to Shared memory, when MS Visual C 6.0 DLL crashes it also causes VB 6 EXE to crash

I have a problem where Due to Shared memory, when MS Visual C 6.0 DLL crashes it also causes VB 6 EXE to crash. Our main program EXE is written in VB 6. It calls plug-ins (DLL's) for the various file types, these are written in MS Visual C 6.0. When a "C" plug-in (DLL) encounters a problem it some times crashes and this causes the EXE pr...

iPhone Distribution Build Out of memory failure?

I keep getting an out of memory failure when I try to do the distribution build of my app. The app only gets up to a max of 12 megs of real memory when testing it in Instruments. Why is this happening? My app folder is only 18 megs without the build folder in it. Turns to 80 megs with the build folder. But this doesn't seem like a l...

Any tool to find size of memory allocated dynamically using malloc/realloc?

Hi, I have a MS-Visual Studio 2005 workspace having all c code. This application(exe) allocates memory dynamically from heap using malloc and realloc. I want to calculate the maximum size allocated size allocated on heap using malloc/realloc by this application program when i run particular test case. I do not want to change the code b...

Where is the leak here?

-(IBAction)gameplayButtonClicked{ GamePlayViewController *screen3 = [[GamePlayViewController alloc] initWithNibName:nil bundle:nil]; screen3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:screen3 animated:YES]; [screen3 release]; } ...

Unable to write in kernel memory via Linux kernel module (Ubuntu)

Hey I'm trying to overwrite certain pieces in kernel memory (Linux 2.6.31, Ubuntu 9.10) in a virtual machine (using VirtualBox) via a kernel module. Whenever I'm doing this I get this error [27154.303726] BUG: unable to handle kernel paging request at 0xc05769bc My code: unsigned char *p = (unsigned char *) c05769bc; p[1] = (add...

Memory Leak in Application Main()

The following code is producing a memory leak on the in retVal line: NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; Any ideas on how to fix? ...

Java memory usages

I cannot understand the Java memory usage. I have an application which is executed with maximum memory size set to 256M. Yet, at some point in time I can see that according to the task manager it takes up to 700MB! Needless to say, all the rest of the applications are a bit unresponsive when this happens as they are probably swapped out...

[C++] Adding to a Memory Address Error

This doesn't compile in VSC++ 2008. void* toSendMemory2 = toSendMemory + 4; I am at a loss at why, though I am sure it's very stupid of me. :P ...

How do i edit Values in Visual Studio 2008?

hello im making a application and i need to know how to change the values of address's for example : Memory Address : 0xB7CE50 Value : 100000 Is there a wiki page or a function for this? if so what is it? ...

A `union` doubt

Suppose I define a union like this: #include <stdio.h> int main() { union u { int i; float f; }; union u tst; tst.f = 23.45; printf("%d\n", tst.i); return 0; } Can somebody tell me what the memory where tst is stored will look like? I am trying to understand the output 1102813594 that this p...

How to print out the memory contents of a variable in C?

Suppose I do a double d = 234.5; I want to see the memory contents of d [the whole 8 bytes] How do I do that? ...

How does this program work?

#include <stdio.h> int main() { float a = 1234.5f; printf("%d\n", a); return 0; } It displays a 0!! How is that possible? What is the reasoning? I have deliberately put a %d in the printf statement to study the behaviour of printf. ...

iPhone Photo Album memory leak

Hello! I made a photo album viewer for iPhone. I have made a scrollview in which i put imageviews with the images. The images are pretty large, about 1 Mb. I have to show about 200 photos. I don't know why my solution leaks, I guess I don't release the imageviews well. I read many topics about these kinds of problems, about image ca...

get size of DataTable or ArrayList in memory

There is some articles about How to get object size in memory ? but they does not explain how to get the size of an object in memory. when I use: System.Runtime.InteropServices.Marshal.SizeOf(arrayListObject) i get error: Type 'System.Collections.ArrayList' cannot be marshaled as an unmanaged structure; no meaningful size ...

java.lang.OutOfMemoryError on Audio Buffer

Hi all, I am currently trying to create an Android application that loops Audio from the mic to the earpiece, I can do that perfectly but when I do it over and over again in my application I eventually get an Out Of Memory Error. Here is the code I use to create the Audio Loop: static final int bufferSize = 200000; final short[...

Meaning of bandwidth in CUDA and why it is important

The CUDA programming guide states that "Bandwidth is one of the most important gating factors for performance. Almost all changes to code should be made in the context of how they affect bandwidth." It goes on to calculate theoretical bandwidth which is in the order of hundreds of gigabytes per second. I am at a loss as to why ho...

How is unsigned int/long represented

I was reading some assembly tutorial in which there were explained the signed integers and the unsigned integers and the difference between their representation in computer memory. I remember something like that there was some bit at the beginning at the number so it tells whether the integer is unsigned or signed. If someone knows it,...

How to use existing Eclipse MAT indexes for interactive analysis

I am attempting to use Eclipse MAT (Memory Analysis Toolkit) to analyze some rather large heap dumps (~2G). My laptop unfortunately has 32bit Windows, and MAT runs out of heap space @ 1.4G allocated heap. I was successful in running the heap indexer from the command line on a large, headless 64bit box. However, I am unable to convince...