@DerrickBarra Profiling in Firefox, initial memory usage (without any textures created using the UI) is:
UI says βIn-Use Memory: 16.85 MBβ
264.50 MB (100.0%) -- explicit
βββ244.76 MB (92.54%) -- window-objects/top(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html, id=34)
β βββ243.41 MB (92.02%) -- active/window(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html)
β β βββ243.12 MB (91.91%) -- js-realm(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html)
β β β βββ242.66 MB (91.74%) -- classes
β β β β βββ169.13 MB (63.94%) -- class(WebAssembly.Instance)/objects
β β β β β ββββ99.38 MB (37.57%) ββ non-heap/code/wasm
β β β β β ββββ69.76 MB (26.37%) ββ malloc-heap/misc
β β β β β βββββ0.00 MB (00.00%) ββ gc-heap
β β β β ββββ72.49 MB (27.41%) -- class(ArrayBuffer)/objects
β β β β β βββ64.00 MB (24.20%) ββ non-heap/elements/wasm
β β β β β ββββ8.49 MB (03.21%) ββ malloc-heap/elements/normal
β β β β β ββββ0.00 MB (00.00%) ββ gc-heap
β β β β βββββ1.03 MB (00.39%) ++ (6 tiny)
β β β βββββ0.46 MB (00.17%) ++ (7 tiny)
β β βββββ0.29 MB (00.11%) ++ (3 tiny)
β βββββ1.35 MB (00.51%) ++ js-zone(0x2ae7588a000)
βββββ9.14 MB (03.45%) ++ js-non-window
βββββ5.00 MB (01.89%) ++ heap-overhead
βββββ2.91 MB (01.10%) ++ (24 tiny)
βββββ2.70 MB (01.02%) ++ threads
Then, after creating 50 textures, UI says
βIn-Use Memory: 227.61 MBβ with
712.54 MB (100.0%) -- explicit
βββ692.77 MB (97.23%) -- window-objects/top(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html, id=34)
β βββ691.41 MB (97.04%) -- active/window(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html)
β β βββ691.14 MB (97.00%) -- js-realm(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html)
β β β βββ690.67 MB (96.93%) -- classes
β β β β βββ520.49 MB (73.05%) -- class(ArrayBuffer)/objects
β β β β β βββ512.00 MB (71.86%) ββ non-heap/elements/wasm
β β β β β βββββ8.49 MB (01.19%) ββ malloc-heap/elements/normal
β β β β β βββββ0.00 MB (00.00%) ββ gc-heap
β β β β βββ169.13 MB (23.74%) -- class(WebAssembly.Instance)/objects
β β β β β ββββ99.38 MB (13.95%) ββ non-heap/code/wasm
β β β β β ββββ69.76 MB (09.79%) ββ malloc-heap/misc
β β β β β βββββ0.00 MB (00.00%) ββ gc-heap
β β β β βββββ1.04 MB (00.15%) ++ (6 tiny)
β β β βββββ0.48 MB (00.07%) ++ (7 tiny)
β β βββββ0.27 MB (00.04%) ++ (3 tiny)
β βββββ1.35 MB (00.19%) ++ js-zone(0x2ae7588a000)
ββββ10.62 MB (01.49%) ++ (26 tiny)
βββββ9.15 MB (01.28%) ++ js-non-window
and after creating another 50 textures for a 100 total, UI says
βIn-Use Memory: 438.31 MBβ with
712.12 MB (100.0%) -- explicit
βββ692.69 MB (97.27%) -- window-objects/top(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html, id=34)
β βββ691.36 MB (97.08%) -- active/window(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html)
β β βββ691.08 MB (97.04%) -- js-realm(https://brandxr-discovery.s3.amazonaws.com/WebGL/MemoryStressTestWebGL/index.html)
β β β βββ690.67 MB (96.99%) -- classes
β β β β βββ520.49 MB (73.09%) -- class(ArrayBuffer)/objects
β β β β β βββ512.00 MB (71.90%) ββ non-heap/elements/wasm
β β β β β βββββ8.49 MB (01.19%) ββ malloc-heap/elements/normal
β β β β β βββββ0.00 MB (00.00%) ββ gc-heap
β β β β βββ169.13 MB (23.75%) -- class(WebAssembly.Instance)/objects
β β β β β ββββ99.38 MB (13.95%) ββ non-heap/code/wasm
β β β β β ββββ69.76 MB (09.80%) ββ malloc-heap/misc
β β β β β βββββ0.00 MB (00.00%) ββ gc-heap
β β β β βββββ1.05 MB (00.15%) ++ (6 tiny)
β β β βββββ0.40 MB (00.06%) ++ (5 tiny)
β β βββββ0.28 MB (00.04%) ++ (3 tiny)
β βββββ1.33 MB (00.19%) ++ js-zone(0x2ae7588a000)
ββββ10.78 MB (01.51%) ++ (26 tiny)
βββββ8.65 MB (01.21%) ++ js-non-window
so there is a very precise linear growth of 210.76MB for both steps (16.85 MB β 227.61 MB β 438.31 MB), which gives a memory usage of 4.2MB per texture inside the WebAssembly heap.
Outside the WebAssembly heap, things look nominal. There is 169.13 MB of memory used for compiled WebAssembly code, and 8.49 MB used for the virtual filesystem. The heap size overreserves using geometric growth, so 512MB at this point is expected, though a tad aggressive. (I have rewritten the geometric growth logic in Emscripten to be more modest, but that is not yet in effect here - that might save 50MB-100MB).
Something you can also try is to use the new Unity βOptimize for Sizeβ build option, if that would shrink some of that 169MB - not sure though if there will be a noticeable correlation to runtime memory usage.