In the my game, I use a native plugin written in C++ (a .dll actually). I would like to measure the GPU memory consumption of this dll. Is it possible? I know, that in the Unity profiler it shows the consumed memory in megabytes, but I don’t know if it only contains the GPU or the CPU memory as well.
I also tried Nsight, but I could not found the an option to show the excast amount of GPU memory.
Any suggestion is appreciated!
Unity’s Memory Profiler relies on the information from Unity’s Memory Manager, as well as OS level callbacks. The latter help gather the total memory usage and on 2023.1+ the page by page residency status, though that typically only covers the CPU memory. We don’t have actual access or address information about the GPU memory. The difference between OS level information and what the Memory Manager reports is then listed as Untracked.
Memory allocated in Native Plugins is therefore only captured as Untracked, if at all (see potential gaps in GPU data), unless it uses our Native Plugin API for the Memory Manager to allocate that memory. I’m relatively sure that won’t work for GPU Memory though?
I think your case is one that we just generally overlooked so it’d be awesome if you could file a feature request via our public Roadmap (clicking on Submit A New Idea) 