I seem to have a fundamental gap in my memory management understanding. The code below is located within a singleton that gets called multiple times within my app to parse data that is downloaded from the web. For each article I download, I allocate a mutable string, then do tons of parsing, then write the file to the file system for la...
This is a bit of a general question, I am debugging and testing on the iPhone and the leaks performance tool is reporting a ton of relatively small leaks from code that I didn't write. I.e. in the responsible frame column the following are blamed for leaks:
[UIColor allocWithZone:]
NSKeyedUnarchiver
NSCFString copyWithZone
CGTypeCreate...
I was trying to study different exceptions in Java and came across the OutOfMemoryError and I wanted to see it in work so I wrote the following program to create infinite objects by creating them in a infinite loop. The program does go in infinite loop it does not throw the OutOfMemoryError exception :(
class Test {
public static vo...
I tend to release my stuff in -dealloc, and now iPhone OS 3.0 introduced this funny -viewDidUnload method, where they say:
// Release any retained subviews of
the main view. // e.g. self.myOutlet
= nil;
So -viewDidUnload seems to get called when the view of the view controller has been kicked off from memory. And if I have s...
The static analyzer is showing up a leak in this block of code (specifically the link with the copy in it):
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName
{
if ([elementName isEqualToString:@"item"])
{
[elements setObject...
There is sometimes a problem with running out of memory when it got fragmented.
Is it possible to find the largest free memoryblock ?
I use Delphi 2007 with FastMM. Developing on Windows XP running app on Windows 2003.
Regards
EDIT:
I could add the info that the app is running on a server with 32 GB memory on a Windows Server 2003 x6...
Hello altogether,
Although it seems to be a very common issue, I did not harvest much information: How can I create a safe interface between DLL boundaries regarding memory alloction?
It is quite well-known that
// in DLL a
DLLEXPORT MyObject* getObject() { return new MyObject(); }
// in DLL b
MyObject *o = getObject();
delete o;
...
Hi,
I have a question regarding free() in C.
Suppose I have a pointer to some struct (say node *ptr).. after freeing it can i Initialize it to NULL and make it point to some new location using malloc() or realloc()?
For Example:
node *ptr=NULL;
ptr=realloc(ptr,sizeof(node)); //works exactly like malloc
/* Do some operations on ptr */...
hi everyone,
maybe i'm having stupid question as always, but somehow i can't google out how should I store variables so it's effective. Our teacher on c++ just by the way droped something about how could size of the stored data type affect the speed of storing it (like searching for closest sufficient continuous block of memory) and I w...
Hi
I am a relatively new iPhone app developer so my knowledge is a little sketchy, so please forgive me if this is a bit of a trivial question.
I have a navigation app which drills between table views by calling pushViewController on the navigationController object
I have one particular section which pushes new view controllers sequen...
I have found some big memory leaks with instruments but have no idea how to figure out where in my code they are. Need some tuts on how to go about that....
...
Im reading the address book contacts... everything goes well until I test a contact with no
First Name ( Since I can create a contact with just an email or a phone or wathever....).
The code (reduced) is this:
- (NSMutableArray *) getContactsInfo {
NSMutableArray *contactsList = [[NSMutableArray alloc] init];
localAddressBook =...
The Leaks Instrument in Xcode shows me an memory leak here. I have commented the affected line which Leaks is complaining about. But I see no error in my memory management...
- (void)setupViewController {
MyViewController *myVC = [[MyViewController alloc] init];
UITabBarItem *tbi = [[UITabBarItem alloc] initWithTabBarSystemItem...
Hi, this is a constructed example. I don't want to post the original code here. I tried to extract the relevant parts though.
I have an interface that manages a list of listeners.
TListenerProc = reference to procedure (SomeInt : ISomeInterface);
ISomeInterface = interface
procedure AddListener (Proc : TListenerProc);
end;
No...
I am runing .net code on a machine with the page file size set to zero. My application logs System.Diagnostics.Process.PagedMemorySize64 and is showing a value > 0.
How can this be?
The documentation for PagedMemorySize64 reads:
The value returned by this property represents the current size of memory in the virtual memory pagin...
A customer has some memory usage requirements of our application. They note that while our committed memory is reasonable, the reserved memory is high. They suspect this is because the CRT heap grows as we allocate memory, but the CRT isn't returning pages to the OS when the memory is deallocated. We are just using built-in operator ne...
Is there any sense to set custom object to null(Nothing in VB.NET) in the Dispose() method?
Could this prevent memory leaks or it's useless?!
Let's consider two examples:
public class Foo : IDisposable
{
private Bar bar; // standard custom .NET object
public Foo(Bar bar) {
this.bar = bar;
}
public void Dispose(...
I am new to objective c and am trying to understand how/when autorelease is called. I understand the simple use case of:
- (void) foo {
Bar *b = [[[Bar alloc] init] autorelease];
[self doSomething:b];
}
What about this next case -- is this a bug, because the object will be immediately released upon leaving the scope of makeB...
Sometimes when coding in Objective C for the iPhone I wonder if I should release an object in dealloc or is it sometimes better to release in viewWillDisappear if that view is a separate rarely used part of your app.
Thanks.
...
I have got custom TableViewCell-s where I assign several UIImageView-s and UILabel-s to the cell's contentview, like this:
[cell.contentView addSubview:iconFileView];
[iconFileView release];
[cell.contentView addSubview:areaLabel];
[areaLabel release];
[cell.contentView addSubview:placeLabel];
[placeLabel release];
As I understand the...