• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
TableView leaks a lot of memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TableView leaks a lot of memory


  • Subject: TableView leaks a lot of memory
  • From: Anders Lassen <email@hidden>
  • Date: Mon, 16 Feb 2009 08:16:04 +0100

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@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Re: Profiling with Shark
  • Next by Date: Re: TableView leaks a lot of memory
  • Previous by thread: handling data relations in Core Data
  • Next by thread: Re: TableView leaks a lot of memory
  • Index(es):
    • Date
    • Thread