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
- URP Realtime reflection probes do not update when RenderProbe() is being called once per second
- Addressable terrain shader variants are stripped from the Player
- [iOS] Debug.Log() appears as <private> in Console app
- UI stays in the background when it is disabled in simulator
- A wrong log file is attached when project is launched with a "-logFile" command line argument
Add comment