Introduction
The primary concern is HOOPS Visualize's usage of system main memory. The dynamic allocation and releasing of memory in Visualize is controlled by an internal memory manager. The memory manager may allocate memory in numerous situations, such as when objects are inserted into the database, an update is performed, or files are loaded. As items are removed from the database, the memory manager takes care of the freeing of the memory associated with them. Visualize allocates memory using its own memory pool and attempts to reuse memory chunks after entities are deleted.
Query System Memory Usage
The amount of memory in use can be queried using HPS::Database::ShowMemoryUsage
. This function will tell us how much system-memory HOOPS has allocated and how much is currently in use. "Allocated" refers to the amount of system memory allocated by Visualize's memory manager. "In use" refers to the amount of memory currently used by the HOOPS scene-graph, which may be less than the amount actually allocated.
Query Video Memory Usage
The total amount of video-memory available in the execution environment can be queried using HPS::WindowInfoControl::ShowVideoMemory
. However, there are no APIs to strictly query HOOPS Visualize's usage of frame buffer-memory. But that should not be a big concern, because it's not system memory usage; rather, it's video-memory allocated on the video card.
The amount of system-memory that HOOPS Visualize has allocated is always going to be the allocated value of HPS::Database::SowMemoryUsage
. All other system-memory usage is due to the application's other data-structures, along with any other system-memory usage that is not explicitly allocated by HOOPS Visualize.
Conclusion
This means when HOOPS Visualize tells the graphics API (OpenGL or Direct3D) to allocate display lists or vertex buffer objects in the video memory, the lower-level OpenGL/Direct3D drivers may also choose to shadow/backup the graphics items in system-memory.
For example, the graphics card may be caching 1GB of graphical entities in the video-memory, but say 500MB of that is also backed-up in system memory. HOOPS Visualize has no knowledge or control over that lower-level system-memory usage.
Additional Resources
More information can be found in our Programming Guide page about Memory ManagementLearn more in our forum post.