NSOutlineView leaks lots of NSTableRowView objects

I have a two-level view-based NSOutlineView, employing a data-source and delegate. It is not populated by binding. My code is all ObjC, and my problem persist since MacOS 10.11 to the current MacOS 14.4.x

Because of some specific visual issue, I use a very simple subclass of NSTableRowView, which has only this:

@implementation MYRowView
- (void)drawRect:(NSRect)dirtyRect {
    self.emphasized = NO;   // this affects the complicated color scheme for selection - will not use the "alternateColor" for drawing, but rather the "secondary color" - who knows what it is. This way our texts and icons and progress do NOT disappear on selected rows.
    [super drawRect:dirtyRect];
}
@end

And then later, in my NSOutlineView delegate:

-(NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item {
    return [OITRowView new];
}

There are, other more complicated

@interface OITOutlineCellView : NSTableCellView

That I makeViewWithIdentifier:owner: and populate in response to NSOutlineView

- (NSView *)outlineView:(NSOutlineView *)outlineView
     viewForTableColumn:(NSTableColumn *)tableColumn
                   item:(id)item {
     

Now I noticed that after adding several items (top level) with some thousands sub-level items to my outline-view, and then REMOVING them and reloading all data - my app's memory is ever increasing

When I used the memory graph feature in Xcode debugger - I found a huge number (actually identical to the maximum number of rows) - all of the class MYRowView. Interestingly enough - none of my cell-views remained in memory.

Now I verified - my data source reported zero items, the UI looks empty, and all functions as expected - except for this "leak" of MYRowView objects.

As you can see in the code (copied exactly from my app) I only create them - and return them to the OS - I never hold any reference to these objects.

So.... What Am I doing wrong, and what can I do to alleviate the issue??

The methods [NSOutlineView reloadItem:reloadChildren:] and [NSTableView reloadData] are documented to "release all related views" -- but obviously they DONT. my app gets to ~300 MB (started at 20MB) with about 7500 rows

Idea anyone? What to check? what to try?

Sorry, the tagging is wrong of course, but I can't see any UI here to change it. why did it chose "GameKit" Time and again I clicked the "AppKit". That's frustrating.

NSOutlineView leaks lots of NSTableRowView objects
 
 
Q