Direct answer
When the target platform supports the compressed texture format generated by the MonoGame Content Pipeline (e.g., DXT5 on Windows, PVRTC on iOS, ETC2 on Android), loading textures via the pipeline yields lower peak memory usage than loading the same PNG at runtime with Texture2D.FromStream.
Confirmed facts
- The Content Pipeline converts source images into platform‑specific compressed formats (DXT5, PVRTC, ETC2, etc.), which reduces GPU memory footprint and eliminates runtime decompression cost.
- Pipeline builds can automatically generate mipmaps, apply premultiplied alpha, and pack textures into atlases, further lowering draw‑call overhead and memory consumption.
- Loading a texture at runtime with
Texture2D.FromStream keeps the raw image in system memory until it is uploaded, then stores an uncompressed surface in GPU memory, increasing peak memory consumption and causing a larger load spike.
Likely explanation
If textures are static (not generated or altered at runtime), the pipeline’s pre‑compression and optional atlas/mipmap generation give a deterministic, smaller memory footprint. Runtime loading becomes necessary only for procedural textures, downloadable content, or dynamic atlases; in those cases the CPU cost of parsing the PNG and the need for manual disposal are unavoidable.
Steps to verify and adopt the pipeline approach
- Ensure your
.mgcb file is set to compress textures for the target platform (check the Processor properties for Texture – it should show a format like Dxt5, Pvrtc, or Etc2).
- Build the project; the Content Pipeline will produce
.xnb files.
- Load textures at runtime via
ContentManager.Load<Texture2D>("assetName").
- When the texture is no longer needed, call
Content.Unload() or unload the specific asset with ContentManager.Unload to free GPU memory.
- Optionally, use a memory profiler (Visual Studio Diagnostic Tools, Xamarin Profiler, or platform‑specific GPU counters) to compare peak GPU memory usage between a pipeline‑loaded texture and a runtime‑loaded
FromStream texture on the target device.
Missing diagnostic detail
To confirm that the pipeline actually reduces memory usage, verify that the target device supports the compressed texture format selected by the Content Pipeline. If the platform falls back to uncompressed textures, the memory advantage disappears and the recommendation may change. Please confirm: does your target platform (e.g., specific Android/iOS/Windows version) support DXT5/PVRTC/ETC2 as reported by the graphics device?