i use instruments to track my app's usage of memory,in memory monitor,i find that real memory is below 36MB ,and most time it just 32MB,but i still get warnings low memory in organizer and crashed.
Incident Identifier: CFEF044E-E839-4DB7-9ED6-E22CD92B9171
CrashReporter Key: 80954447762f1882da7df309d5493cf8647f4c8b
OS Version: ...
Hi,
consider the following Objective-C++ iPhone Application (TestMemAppDelegate.mm). It crashes with an EXC_BAD_ACCESS on the iPhone (3GS with iOS 4.0). It works fine in the Simulator. It is clearly a memory alignment thing, because it works fine on the iPhone if the "DataA" struct starts on a 8 Byte border.
Can anyone explain the caus...
Imagine I am using a class to bring back items from a database, say
class BankRecord {
public int id;
public int balance;
public void GetOverdraft() {
...
}
public void MakeBankrupt(){
...
}
}
Now, what would happen to the performance of using this if there were just 2 methods (as above) or 100 methods, maybe some of them very larg...
I'm writing a Windows CE application, and I want to play a sound (a short wav file) when something happens. Since this sound will be played often, my first instinct was to load the wav file into a memory stream and reuse that stream instead of reading the file every time.
But then it occured to me that these Windows Mobile devices only ...
I am having a java application and spawns lot of threads..and due to out of memory error..it dies if it runs for too much time.. Is there a jvm configuration parameter, that I can set so that it will wait for memory when no memory is available, instead of throwing out of memory error.
...
I'm writing an array-backed hashtable in Java, where the type of key and value are Object; no other guarantee.
The easiest way for me code-wise is to create an object to hold them:
public class Pair {
public Object key;
public Object value;
}
And then create an array
public Pair[] storage = new Pair[8];
But how does the j...
I need to store in my object which values have already been handlerd, I am doubting what would cost more performance, should I create an array that stores:
The instance references (they are not structs, only ref classes)
The hashcode of the items
The name of the name of the properties (string) that have been handled
Update
my aim is ...
Hello,my friend.
I'm developing an "Online Judge System",like SGU "http://acm.sgu.ru/"
I wangt to obtain the accurate consumption memory of running ".exe"(.c/.cpp-->.exe) using Java.
Process : submit code-->hello.cpp/.c--compile-->hello.exe--run-->results
I want to know how to obtain the consumption memory of running "hello.exe"
Th...
Hi all.
We develop a server and we want to program congestion control into it.
What we want to do is detect when free heap is below a certain threshold and stop accepting new data until free memory goes up again.
Our first approach used runtime.freeMemory. This caused false positives as free heap went below the threshold before GC kicked...
Dear All:
I have faced such a problem.
I have a library which allows through UDP inter-process communication.
It is very straight forward. The library creates shared memory available for other processes to write and read from. When process wants to read a interested memory it passes a string value which uniquely points to corresponding ...
I've read about the different kinds of GC and how they work. All involve traversing the set of memory which might potentially be reclaimed, but nothing I've read gives any indication as to how this is actually done. Would something like the following be way off the mark?
void* myAlloc(size_t size)
{
if (needToGc())
gc();
...
I am having a problem with memory management I think. My NSArray (called arr) is turning into different things at random times. I have no idea why. I have a .h file that that declares the array, and then I initialize the array using
NSString *input = [[NSString alloc] initWithData:myData encoding:NSACIIStringEncoding];
arr = [input com...
In C++, I understand that the delete operator, when used with an array, 'destroys' it, freeing the memory it used. But what happens when this is done?
I figured my program would just mark off the relevant part of the heap being freed for re-usage, and continue on.
But I noticed that also, the first element of the array is set to null,...
Is the way C++ structs are laid out set by the standard, or at least common across compilers?
I have a struct where one of its members needs to be aligned on 16 byte boundaries, and this would be easier if I can guarantee the ordering of the fields.
Also, for non-virtual classes, is the address of the first element also likely to be th...
So, I ask this question in the context of a basic text input function I see in a C++ book:
char *getString()
{
char temp[80];
cin >> temp;
char * pn = new char[strlen(temp + 1)];
strcpy(pn, temp);
return pn;
}
So temp declares an array of 80 chars, an automatic variable whose memory will be freed once getString() r...
A few simple questions.
const int gFirst;
const int gSecond;
struct Data
{
static int First;
static int Second;
int first;
int second;
};
Data data;
Is it guaranteed that the following statements are true?
1) &gFirst < &gSecond
2) &Data::First < &Data::Second
3) &data.first < &data.second
...
Hi Everyone,
I recently wrote a post:
http://stackoverflow.com/questions/3452355/weird-error-in-c-program-removing-printout-breaks-program
...in which I was trying to solve a seemingly baffling problem, in which removing a cout statement would break my program.
As it turned out, my problem was that I forgot to return my true/false succ...
I have a Swing browser application with a bug that as I add/remove to/from the GUI the memory isn't released for those objects and I'm trying to track down what is holding onto them. Problem is I don't know how to tell when something has actually be fully released from memory.
Is there a way to tell if an object has been released from ...
I have a lot of memory allocations and the same number of FreeMem calls. What I didn't have though is a check before calling freemem to see if the pointer was nil, and a line after freeing to set the pointer to nil.
I tried to create a function to do this
procedure FreeMemAndNil(p: Pointer; size: Integer = -1);
begin
if p <> nil t...
I am writing an application that uses UIImagePickerController to take multiple pictures with the camera as fast as iOS allows. My application has to run on iOS 3.13 on all versions of iPhone hardware (v1 through 4). I am using UIImagePickerController with a cameraOverlayView.
My question is, how can I determine programmatically how man...