Assets never unloading after loading next scene

I’m having an issue in an iOS app where my assets for each different scene are not being unloaded once I load another scene. Here’s some background on what I’m doing:

I was having memory issues when loading a scene with Application.LoadLevel(), so I changed to loading a blank scene between each level and using Application.LoadLevelAdditively() as discussed in this topic. This helped and I’m able to actually load the scenes now on an iPad1, however I noticed after loading a few scenes I was receiving the low memory warning again. Come to find out my loaded object count was never dropping based on this printout from XCode:

Unloading 18 unused Assets to reduce memory usage. Loaded Objects now: 221.

This amount steadily increases as I change scenes, and rarely removes any unused assets. These scenes share very few common assets, so nearly all of them should be being restored after I change scenes, or at least I assumed they should.

I’m using SpriteManager1 in this project to manage/draw sprites and I’ve heard of a few others stating they had issues releasing assets from SpriteManager. However, I have several other assets (Camera objects, GameObjects with just scripts attached, etc) that are persisting through these scenes as well, so mine issue seems to be related to every Object in my scenes.

I’m also monitoring how much memory I’m using through a simple prinout in objective-c by using:

- (void) report_memory:(NSTimer *)timer {
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(info);
kern_return_t kerr = task_info(mach_task_self(),
                               TASK_BASIC_INFO,
                               (task_info_t)&info,
                               &size);
if( kerr == KERN_SUCCESS ) {
    //NSLog(@"Memory in use (in bytes): %u", info.resident_size);
    printf_console("Memory in use (in bytes): %u

", info.resident_size);
} else {
//NSLog(@“Error with task_info(): %s”, mach_error_string(kerr));
printf_console("Error with task_info(): %s
", mach_error_string(kerr));
}
}

I print this information every 2 seconds just to quickly gauge how much memory my scenes are requiring. Of course, this increases in size as my assets continue to pile up and never unload as I change scenes.

I’ve tried manually calling the garbage collector as I load levels and I call Resources.UnloadUnusedAssets() during my blank scene just to be sure we’re trying to clear the unused assets, but these proved unsuccessful.

I’m using the Unity Pro version 3.4.2 with the iOS Pro license if that makes any difference.

Thanks

Do you have any "#if"s i.e “#if UNITY_ENGINE” around any serialized properties? I found this causes unpredictable asset retention.

You could also do a find query in the blank level to see what behaviors are remaining.

FindSceneObjectsOfType(typeof(Behavior));

Then see which of these might be retaining connections.