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
- [Linux] Screen.SetResolution immediately applies windowed resolution when switching from Fullscreen to Windowed mode
- Lighting window allows non-cube map texture for Environment Reflections, throwing invalid texture type (2D) error
- Console warning “MismatchingRepositoryProjectMessage” when creating a new Unity Version Control workspace
- [Ubuntu] VFX Graph Enum Value menu stretches across screen when entered long Enum Value
- Unclear warning message in Rendering Debugger about the Play mode Debugger Overlay
Add comment