Search Issue Tracker
Fixed in 2019.1.X
Votes
0
Found in
Issue ID
932011
Regression
No
[Scripting, Profiler] It's not possible to get runtime size for meshes
With the current APIs Unity provides, it is difficult to determine exactly where the memory footprint for a mesh is coming from, especially during runtime. Get internal memory during runtime in release mode is not possible which leads to estimates which is difficult without knowing the correct format which depends on many different factors. During profiling it's possible, but you will always get the profiler overhead. e.g. via Profiler.GetRuntimeMemorySize (mesh);
For Meshes there is already a call used by the profiler Mesh::GetRuntimeMemorySize() which consists of 2 parts which only return related memory in dev mode, otherwise zero.
- Profiler.GetRuntimeMemorySize (mesh); Includes base memory footprint for C++ objects as well as the base class.
- SharedMeshRenderingData::GetRuntimeMemorySize() returns the index buffer size + the vertex streams included.
So in theory we can enable the second part during runtime as it doesn’t require the profiler. This requires additionally scripting bindings. See the attached diff for the implementation. This returns the size the mesh occupies via mesh.GetRuntimeMemorySize ().
TestStuff.cs tests the call against other API calls in
Debug.Log("GetRuntimeMemorySize: "+mf.mesh.GetRuntimeMemorySize ());
Build the test scene in non development mode to iOS/Android and test on device.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Add comment