memory-management

does removefromsuperview releases the objects of scrollview?

for(UIView *subview in [scrollView subviews]) { NSLog(@"subviews Count=%d",[[scrollView subviews]count]); //[subview release]; [subview removeFromSuperview]; } in the above method if i use [subview removeFromSuperview]; it works fine...but if i use [subview release]; it crashes....i want to know that if both are same or is the...

Find mapping between Windows heap and modules

Hi all! I am searching for a way to find a mapping between a heap and the module which owns the heap. I retrieve the heaps in the following way: HANDLE heaps[1025]; DWORD nheaps = GetProcessHeaps((sizeof(heaps) / sizeof(HANDLE)) - 1, heaps); for (DWORD i = 0; i < nheaps; ++i) { // find module which created for heap // ... } The ...

max heap usage allowed per process

hi friends i m using malloc to allocate memory and memory requirements are greater than 1GB. so program is crashing... i want to ask whether this problem can be solved??If yes than how?? my RAM size is 3GB and using 32 bit windows os and programming using vc++ ...

Memory allocation and deallocation across dll boundaries

I understand that memory allocations made in one dll then subsequently free'd in another can cause all sort of problems, especially regarding the CRT. These sorts of problems are especially problematic when it comes to exporting STL containers. We've experienced these sorts of problems before (when writing custom Adobe plugins that lin...

How do I release the ACTUAL memory and not just the pointer to the memory?

I am releasing things but the memory seems to still be there according to instruments. Am I just releasing the pointer and not the actual data? How do I release THE DATA in objective-c? What's the difference between [anObject release] or [&anObject release]???? Please excuse my lack of knowledge on the subject of memory and pointers. ...

What is happening to memory when I do this (memory question)?

I am trying to figure out how to pass a UIImage around between various view controllers without duplicating the UIImage and increasing memory unnecessarily. The image is passed successfully using the method below, but I cannot seem to free up this UIImage later on, which ends up weighing down my app with 7MB+ of data that cannot be accou...

What does GeneralBlock mean in the ObjectAlloc Instrument?

I am trying to free up some unused resources in my app. I have a couple MBs of an (object?) of category GeneralBlock and I have no clue what this is or how I should be approaching the freeing up of this GeneralBlock. GeneralBlock has no apparent use. When I start my app there is a MENU screen at which point in time I have about 300kb o...

Is there any advantage to deallocating objects owned by the UIApplicationDelegate?

Best practices aside, if I create an object that is owned by my UIApplicationDelegate class, and stays around the entire time the application runs, is there any real advantage to adding an [object release] statement in the UIApplicationDelegate's dealloc method? The only time that would be called is when the user is shutting down the ...

C++, Free-Store vs Heap

Dynamic allocations with new/delete are said to take place on the free-store,while malloc/free operations use the heap. I'd like to know if there is an actual difference, in practice. Do compilers make a distinction between the two terms? (Free store and Heap, not new/malloc) ...

Using delphi application's memory manager in a delphi DLL (without recompiling the application)

I need to write a DLL (using Delphi) which is dynamically loaded into delphi applications and makes RTTI queries (typical operation is to obtain string values for control properties). The classic problem is that passing strings (and objects) between application and DLL is problematic due to different memory managers used in both (this mi...

Share NSArray Contents between multiple methods in a single class

What am I doing wrong? My code crashes when I try to log the array. Here is my class: @interface ArrayTestAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; NSArray *array; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) NSArray *array; -(IBAction)buttonPressed; @end @...

Is « my » overwriting memory when called in a loop?

Hi, A simple but relevant question: Is « my » overwriting memory when called in a loop? For instance, is it "better" (in terms of memory leaks, performance, speed) to declare it outside of the loop: my $variable; for my $number ( @array ) { $variable = $number * 5; _sub($variable); } Or should I declare it inside the loo...

remove every type of subview from uiscrollview?

hello all i am using this code to show flip animation...... i have a uiview with scrollview(paging enabled)...so it shows a view like a page...now i also have done flip animation using this code.... -(void)flipView { flashCardAnswerController *flashCardAnswerControllerobj = [[flashCardAnswerController alloc] initWithNibName:@"Flash...

Tricks to manage the available memory in an R session?

What tricks do people use to manage the available memory of an interactive R session? I use the functions below [based on postings by Petr Pikal and David Hinds to the r-help list in 2004] to list (and/or sort) the largest objects and to occassionally rm() some of them. But by far the most effective solution was ... to run under 64-bit ...

free() errors (debugging with valgrind)?

I have these structs: typedef struct _Frag{ struct _Frag *next; char *seq; int x1; int length; }Frag; typedef struct _Fragment{ int type; Frag *frag_list; }Fragment; And then I created a array Fragment *fragments=malloc(1,sizeof(Fragment)); // or more fragments->frag_list=malloc(1,sizeof(Frag)); // or more Frag *...

iPhone memory management question

Hi to all! I dropped 2 days on this problem and can't come out with a solution so: (I know this wont have much sense but hopefully it will do the trick) monkey.h @interface monkey : NSObject { NSNumber *monkeyRanch; } @property (nonatomic, retain) NSNumber *monkeyRanch; -(id) gatherTheMonkeys:(int)howmany; monkey.m @synthesize monk...

Using JavaScript with Internet Explorer, how do I clear memory without refreshing the page?

I have an AJAX-based website using JavaScript on the client. Certain operations on the site cache large result sets from service calls in the browser (i.e. hundreds of megabytes). These are throw-away results. They will be viewed for a short time and then need to be cleared from memory. I've written a small test site that loads a b...

Does java garbage scheduler depict it details in some form ?

The scheduler that runs as a daemon in JVM to garbage collect objects, can it be monitored with JMX.Do we have some way of telling that these are the objects it might garbage collect now.That way we can figure out that if we are creating specific objects of our classes and the instances are held up in memory of when they can be garbage c...

Understanding Cocoa Memory

What is the advantage of doing this: NSArray *array = [[NSArray alloc] initWithObjects:@"Year", "@Capital", ..., nil]; self.hintArray = array; [array release]; Instead of assigning directly to my class variable like this: self.hintArray = [[NSArray alloc] initWithObjects:@"Year", "@Capital", ..., nil]; Why do we create a temporary ...

Object not releasing objective C

I am having trouble understanding why NSLog reports "dog" when the code is run. I understand about retain counts and dealloc e.t.c. What simple thing am i missing ? NSString *newFoo = @"dog"; [newFoo release]; NSLog(newFoo); ...