Suppose I have the following C++ class:
class Foo
{
double bar(double sth);
};
double Foo::bar(double sth)
{
double a,b,c,d,e,f
a = b = c = d = e = f = 0;
/* do stuff with a..f and sth */
}
The function bar() will be called millions of times in a loop. Obviously, each time it's called, the variables a..f have to be allocated....
Hello,
If we have this code in our interface .h file:
@interface CarModelSelectViewController : UITableViewController {
NSString *fieldNameToStoreModel;
NSFetchedResultsController *fetchedResultsController;
NSManagedObjectContext *managedObjectContext;
DataEntered *dataEntered;
}
@property (nonatomic, retain) NSString *fieldNameTo...
I understand the purpose of the NULL constant in C/C++, and I understand that it needs to be represented some way internally.
My question is: Is there some fundamental reason why the 0-address would be an invalid memory-location for an object in C/C++? Or are we in theory "wasting" one byte of memory due to this reservation?
...
The MFC program I am debugging is printing this message in the "Output" window in Visual Studio 9.0:
HEAP[AppName.exe]: Invalid allocation size - 99999998 (exceeded 7ffdefff)
I'm pretty sure this is due to a bad "new", uninitialized variable or similar error.
The question is: how do I get the debugger to stop on this message so that ...
Hi,
Is it the correct way of allocating memory to a char*.
char* sides ="5";
char* tempSides;
tempSides = (char*)malloc(strlen(inSides) * sizeof(char));
...
I have tested my iphone app using XCode and instrument. I am watching the memory allocation tables, its showing me that every things is increasing i.e Bytes, Live Bytes and so on.
What does it means? Am i not deallocating the objects?
Can i find which objects are not deallocating using instruments?
...
Hello,
Has anybody used SmallObjectAllocator from Modern C++ Design by Andrei Alexandrescu in a big project? I want to implement this allocator but I need some opinions about it before using it in my project. I made some tests and it seems very fast, but the tests were made in a small test environment. I want to know how fast it is whe...
When editing a large fla (400mb - don't ask!) Flash will sometimes run out of memory and tell me to allocate more memory (in Finder I think). Obviously these are instructions for Mac that have erroneously made it to the Windows version - but is there anything I can do to allocate more memory in Windows Vista?
...
I have been assigned to work on some legacy C++ code in MFC. One of the things I am finding all over the place are allocations like the following:
struct Point
{
float x,y,z;
};
...
void someFunc( void )
{
int numPoints = ...;
Point* pArray = (Point*)new BYTE[ numPoints * sizeof(Point) ];
...
//do some stuff with points...
Do I need to allocate memory when performing a Delphi string copy?
I've a function which posts a Windows message to another form in my application. It looks something like this:
// Note: PThreadMessage = ^TThreadMessage; TThreadMessage = String;
function PostMyMessage( aStr : string );
var
gMsgPtr : PThreadMessage;
gStrLen : Int...
I was wondering how I could allocate (and De-Allocate) an array of char pointers (char*[64]) in C. I've looked around on the web for examples but they all focus on other datatypes or one dimension arrays.
...
I have a UIViewController and I'm noticing that I've done something to where the didReceiveMemoryWarning method is getting called every time I run it on an actual device.
I've run the project with Run > Run With Performance Tool > Object Allocations (and Leaks also). There are no leaks but I have no idea how to read or understand the "...
I'm sorry to ask such a simple question, but it's a specific question I've not been able to find an answer for.
I'm not a native objective-c programmer, so I apologise if I use any C# terms!
If I define an object in test.h
@interface test : something {
NSString *_testString;
}
Then initialise it in test.m
-(id)init {
_test...
I've slurped in a big file using File::Slurp but given the size of the file I can see that I must have it in memory twice or perhaps it's getting inflated by being turned into 16 bit unicode. How can I best diagnose that sort of a problem in Perl?
The file I pulled in is 800mb in size and my perl process that's analysing that data has ...
How does one use VirtualAllocEx do make room for a code cave? I am currently in possession of a piece of software with very little "free space" and i read that VirtualAllocEx is used for making this space..
Thanks!
Jake
...
Having tried this
int main(void) {
int a[10];
a[20]=5;
}
gcc -Wall -O2 main.c
It gives me no warning...
It's gcc within windows (mingw) and I am not able to detect this kind of boundary limit bug
how to tell compiler to check it? can mingw do it?
thanks
...
This might be a dupe. I did not find enough information on this.
I was discussing memory allocation for collections in .Net.
Where is the memory for elements allocated in a collection?
List<int> myList = new List<int>();
The variable myList is allocated on stack and it references the List object created on heap.
The question is wh...
Hi all,
I need to optimize the RAM usage of my application.
PLEASE spare me the lectures telling me I shouldn't care about memory when coding Python. I have a memory problem because I use very large default-dictionaries (yes, I also want to be fast). My current memory consumption is 350MB and growing. I already cannot use shared hosting...
The code for this question is too long to be of any use. But I'm pretty sure my problem has to do with releasing a class.
I have a helper class, ConnectionHelper.h/.m, that handles a NSURLConnection for me. Basically, I give it the URL I want and it returns the data (it happens to do a quick json parse on it too). It has a delegate w...
Hi,
We have sql 2005 32 bit running on win 2003 64 bit box containing 5 gb RAM.
Is there a way that sql starts using more than 2 gb? some switch or some setting in sql server?
When I go to my sql server properties and try to increase the max server memory to > 2GB, it reverts back to old 2 GB.
Thanks,
Anand
Correction - Guys: I nev...