Hi.
When I exit my C++ program it crashes with errors like:
EAccessViolation with mesage 'Access violation at address 0...
and
Abnormal Program Termination
It is probably caused by some destructor because it happens only when the application exits. I use a few external libraries and cannot find the code that causes it. Is there a f...
Should I release strPhone? What about the coreFoundation object being cast to an NSString? What happens to it?
strPhone = [[NSString alloc] initWithUTF8String: [[(NSArray *)ABMultiValueCopyArrayOfAllValues(theProperty) objectAtIndex:identifier] UTF8String]];
Thanks for helping me understand.
...
I'm getting a potentially leaked object error from the Static Analyzer for this line:
strCleanPhone = [[[[strPhone stringByReplacingOccurrencesOfString:@" " withString:@""]
stringByReplacingOccurrencesOfString:@"(" withString:@""]
stringByReplacingOccurrencesOfString:@")" withString...
I have this huge problem with memory management.
I have been googling for 8+ hours, with no success...
The problem:
I've got a UIScrollView, I've got an Array with 24 paths to Images in it and I want to show them in the UIScrollView with paging enabled.
All images is in the size 1024x748 (iPad landscape resolution with status bar) and...
I am working on a Tetris AI implementation. It is a GUI application that plays the game by itself. The user can manipulate a few parameters that influence the decisions made by the AI. The basic algorithm goes as follows:
Start a new thread and clone the current game state to avoid excessive locking.
Generate a list of all possible fut...
I have a std::list in a C++ program, which contains objects of a Class A.
Lets say I have 10 objects in it. I have a reference to the 6th object stored, in another data structure say ref_6. Lets say I need to remove the 8th element from my list. To do this, I would use pop_front 8 times and store 8 objects in a vector and use push_front...
I am converting an implementation of an image segmentation method from C++ to Matlab.
It is an iterative method that that make calls to two functions: em() and mpm(). Those two functions uses two reasonably big auxiliary matrices, so to avoid reallocating memory at every call in my C++ implementation, I have prealocated the memory for t...
void aFunction_2()
{
char* c = new char[10];
c = "abcefgh";
}
Questions:
Will the: c = "abdefgh" be stored in the new char[10]?
If the c = "abcdefgh" is another memory area should I dealloc it?
If I wanted to save info into the char[10] would I use a function like strcpy to put the info into the char[10]?
...
Hi
Can any one guide me in clearing the memory leaks in the iphone code.
in xcode editor it does not shows any issues,
so i hav uploaded my app to the AppleStore.
they rejected my app.
so kindly help me what is my issue?
how to rectify it.
Thanks in advance
...
Why in this code (this is just working code and not fully exception safe) I'm getting an assertion error:
HEAP_CORRUPTION_DETECTED ...
class Allocator
{
public:
explicit Allocator()
{
std::cout << "Allocator()" << '\n';
}
virtual ~Allocator()
{
std::cout << "~Allocator()" << '\n';
}
tem...
std::string str = "string":
const char* cstr = str.c_str();
str.clear();
//here, check if cstr points to a string literal.
How do i check if cstr still points to a string when running the program in debug or release mode?
Would there be a way to determine this using exception handling in C++?
...
I am writing a PHP script (to be run from command line) to parse hundreds of large JSON files. All of these files are in a directory. Initially I was reading the files one by one and parsing them in the same script, but ran out of memory quickly. The other way to do it is to have two scripts, one to read the directory, get the list of...
Hi, I have very frustrating problem.
When I try to release NSKeyedUnarchiver object after decoding an NSArray, "EXC_BAD_ACCESS" error occurs.
But when I don't release it or decode other object (e.g. NSString) everything go well.
I don't understand it... For me, it looks like "decodeObjectForKey" method changes something in "decoder" obje...
Background: I have a large 2D array of integers that I need to load into memory in PHP for each Apache request. I want it to take up less memory.
PHP stores ints in PHP_INT_SIZE bytes, which is 32 bits on most systems. All the integers are less than 2^16, which means they could be a short int (eg in C). Am I right in thinking that stori...
Hi, am writing an application that plots point on a graph and am using the below method to return an array of these points. I have two views, each displaying different graphs but both have this identical method. Whichever graph is used second causes the application to crash when it reaches the line "NSArray *reading ...". I can't figure ...
Hi,
I had a look at instruments and I saw that the alloc increased the retain count by 1. So far everything clear. But the assignment of the class to my property also increased the retain count to 2.
self.myProperty = [[MyClass alloc] init]
Vs.
MyClass *myCreatedVariable = [[MyClass alloc] init];
self.myProperty = myCreatedVariable
...
How do you release the memory in this situation? Do you have to?
- (NSString *) whatHappensHere {
NSMutableString * mutableString = [[NSMutableString alloc] initWithString:@"Hello"];
// ....
// more code ...
// ...
return mutableString;
}
...
I have a controller that makes HTTP GET requests using a custom class, which acts as the delegate for the NSURLConnection. Once the NSURLConnection fails or finishes, the custom class invokes methods on the controller and passes along an NSData object of received data.
I'm running into a problem where the controller in action is being d...
Hi all,
Most architectures have a memory map where the user application grows towards
lower memory where the stack grows to the opposite direction. I am wondering what
is happening when I write such a big C-program that all the space for the application
and the is taken away, ie, that stack pointer and application try to write to the sa...
I have an application and I want to make a trace of all the data memory locations that it accesses. Is there any script or tool that can help me retrieve the memory locations accessed by my application ?
...