If a retain (reference) count of an object is greater than 1 in a dealloc method right before releasing does this mean there will be a memory leak?
I was debugging my code to find another issue but then ran into this subtle one. One of my object's retain counts was 3 in the dealloc method. This object is a property with retain and is ...
In C the standard memory handling functions are malloc(), realloc() and free(). However, C++ stdlib allocators only parallel two of them: there is no reallocation function. Of course, it would not be possible to do exactly the same as realloc(), because simply copying memory is not appropriate for non-aggregate types. But would there ...
My app uses a lot of substringWithRange method, almost all over the place.
Reading messages from the server (socket), and separating the string to, populate data on the screen.
I get random leaks on [NSCFString substringWithRange:],
about 128 bytes leak after running the app for 40 minutes.
How can a substringToInsex, or substringFromInd...
where pointers and global variables in C are saved in memory, in heap or in stack?
...
If I declare a function such as:
NSString* createAString(std::string toConvert);
NSString* createAString(std::string toConvert)
{
return [NSString stringWithUTF8String:toConvert.c_str()];
}
I was under the impression that because I didn't call alloc on the string it will be in the autorelease scope.
When I run this code XCodes...
I'm not sure exactly how to describe this question, but here goes. I've got a class hierarchy of objects that are mapped in a SQLite database. I've already got all the non-trivial code written that communicates between the .NET objects and the database.
I've got a base interface as follows:
public interface IBackendObject
{
void Re...
Possible Duplicate:
JavaScript: Setting methods through prototype object or in constructor, difference?
I guess this is a question about the browsers implementation of closures really. I know about the numerous ways to emulate Class-like functionality within JavaScript including using various libraries. This is more a questi...
Hello,
I think I have a problem, maybe linked to a retain cycle in Core-Data.
The code is a follow, where self.image is also a NSManagedObject:
- (void)setImage:(UIImage*)image1 andThumbnail:(UIImage*)image2
{
self.image.data = UIImageJPEGRepresentation(image1, 0.85); // This is autoreleased
self.thumbnail = UIImageJPEGRepresen...
I have implemented pdf reader application for ipad.Its working fine in simulator.But its terminated in device with exit status 10.I done know whats happning.Please help me solve this problem.
Thanks in advance.
...
Is there a way in Java to do something just before running out of memory. For example, keeping a list of previous document states (for undo) and only removing very old states when memory is about to be exhausted?
...
I was reading this article on MSDN
"Managing Heap Memory in Win32"
And in it they are explaining about a tool called ProcessWalker.exe
In the article they explained that they can use this tool to explore the contents of virtual memory of any process.
Does anyone know where I can download this tool from. Or maybe ProcessWalker might b...
This question made me curious. Questions like this always get answers like "It's generally safe but you shouldn't assume that the OS will do this for you", which sounds like good advice to me, but I'm wondering: Are there any actively-developed (released) operating systems that don't do this?
Is this something that was fixed back in the...
I'm an iPhone/Objective-C newbie with an extensive Java background.
I'm learning more about memory management in objective-c and I'm reading Apple's documentation on Memory Management: http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html
In the Object Ownership Policy section, it says that...
I've just come across a nice STL-like tree container class written by Kasper Peeters:
http://tree.phi-sci.com/
However, because it's STL-like, it's geared towards having a single class type in the tree; i.e. template <class T>. The trouble is, like STL-lists, if it suffers from the polymorphic class problem, in that the objects in the...
I have a bunch of files (on the order of 10 per second) coming into a system (stored into a database). Each file contains an entry for somewhere between 1 and 500 devices. A given device will appear in multiple files (but not every file). This data eventually needs to be stored in another database, stored per-device. There are two differ...
I ran Instruments on my iPad app to check for leaks. It found several "leaks" where an object was being retained in a method:
But these objects are released later in dealloc:
Are these classified as false-positives?
...
Hi there,
I'm having some trouble with a program that is intended to be a String buffer, specifically this function is intended to reset the buffer with the string cstr. If cstr is null then the content needs to be reset to an empty char '\0'. It always hangs at the second set of realloc where it's resizing buf->contents I have no clue w...
If I have a function like this
void setSomeObject( SomeObjectClass obj /*, and some other params*/ )
{
[_previous autorelease];
_previous = obj;
}
As far as I understood it the autorelease message is sent to the object itself (not _previous)
so at one point, sometime when setSomeObject goes out of scope the original object is auto...
The following program loads two images with PyGame, converts them to Numpy arrays, and then performs some other Numpy operations (such as FFT) to emit a final result (of a few numbers). The inputs can be large, but at any moment only one or two large objects should be live.
A test image is about 10M pixels, which translates to 10MB onc...
When a new process is created the Address space is created using fork() i.e new page table entries are created for the new process which are exactly same as the parent process.
After fork() the exec() is called. What happens during the exec() system call?
I read in the book "Operating system concepts " that when a new program is execute...