Hi,

I am working on a small Cocoa application, which uses a TableView to display information that is collected from an internet site. A timer reloads the TableView every second.

The problem is that everytime the timer reloads the TableView, about 5 - 20 MB of memory is used (depending on how many rows there are in the tableview).

After running a while, all free memory is used on the computer, and it begins to swap.

I have figured out that this happens due to the following conditions:

- The garbage collector is on
- A timer is used for reload
- A column contains a Check Box Cell

Ergo, the problem vanish, if I:

- turn the garbage collector off
- or reload manually
- or remove the Check Box Cell

I am a bit surprised about this, since I guess that other may have ran into to the same problem.

Note that the program is very simple. The main window only contains a TableView with one column, which has 10 rows. Each cell contains a Check Box Cell.

The code is:

@implementation Controller

-(void)awakeFromNib
{
timer = [[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timer:) userInfo:nil repeats:YES] retain];
}

- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
   return 10;
}

-(void)timer:(NSTimer*)timer
{
   [tableView reloadData];
}

@end


Thanks

Anders Lassen

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to