Memory, Asset Bundles and Scene Loading

I’ve been studying Asset Bundles for purposes like memory management and general project loading optimization.

It’s a broad topic with many links to other inner unity architectural details.

I have a relatively basic question that I couldn’t figure out myself. In the following scenarios with included simple memory profiler data the only difference is that the same scene is loaded from Streaming Files using
AssetBundle.LoadFromFile(path) API and using

var scenePaths = loadedAssetBundle.GetAllScenePaths();
SceneManager.LoadSceneAsync(scenePaths[0]);

Ignoring the GfxDriver usage the main difference is coming from the title "Unity" which is as far as I understand natively managed memory which is readonly and reusable by the OS itself.

What causes the major (x2) difference how to avoid it if even possible?

Scenario 1: Loading a scene with heavy mesh and textures content.

Scenario 2: Loading an asset bundle with that scene and the loading the same scene.

Without seeing more details, I suspect what you are seeing is duplicated data being loaded in the Asset Bundle case.
Asset Bundles were designed to pull in everything they need to load the scene, so depending on how your dependency tree looks in your example, what might be happening is that your base example contains data that is being loaded, even before the scene is loaded in Scenario 1 but is also used by the scene. While in Scenario 2 due to Asset Bundles containing all their dependencies, it loads all it’s data it needs to work, which is duplicated data because it can’t reference the data that a built in scene can load.

Generally speaking, when the dependency trees are setup correctly, Asset Bundles will be nearly identical for scene loading in the basic case, and have better memory usage in games with lots of scenes. Though it is harder to set up data this way from user code, so we are working on tools such as Addressables to ease this process.