CPTemplate is not released in CarPlay

This is the CarPlay page, and the phone is running iOS17.5

The template creation code is as follows:

CPListTemplate *listTemplate = [[CPListTemplate alloc] initWithTitle:@"最近播放" sections:sections];

listTemplate.delegate = self;

[_interfaceController pushTemplate:listTemplate animated:YES completion:^(BOOL success, NSError * _Nullable error) {

}];

sections have many CPListItem.

When I exit the page, but the page does not free, causing memory to keep increasing.

I tried to refresh empty sections after exiting the page and memory freed for me, which confused me.

Do we have to manage the memory ourselves?

Are any objects in your app holding a strong reference to the list template? Also check the handler in each list item to ensure there aren't any strong references back to an owning object, and replace those with weak references. Either of the above could be the cause of a retain cycle in your app that prevents the template from deallocating.

CPTemplate is not released in CarPlay
 
 
Q