In my application a bam database file is loaded and after the simulation is stopped, all memory is released, after which a new database bam file is loaded. These databases can be quite big and are divided into tiles which are flattened to optimize performance. However, each time the same database is loaded after it has been released GPU memory (measured with GPU-Z) on my RTX2080 GPU increases with around 800 MB, and memory measured with
*def getMBUsed( self ):*
-
pid = os.getpid()*
-
ps = psutil.Process(pid)*
-
memUse = ps.memory_info()*
-
return (memUse.vms/1048576)*
also increases substantially. So memory is not released.
I do tthe following to release memory at the end of each simulation:
- find all nodepaths that are stored in lists and tables and then do obj.removeNode()
- clear all lists with list.clear()
- do ModelPool.releaseAllModels()
- do TexturePool.releaseAllTextures()
- do TexturePool.garbageCollect()
- do for i in range(2): n = gc.collect()
and then the system sais that the number of unreachable objects is 0
I also checked len(gc.get_referrers(nodepath)) for all nodepaths that were created and this always returns 1 which means that the garbage collection can clear the memory.
Does anyone have a suggestion how I can free all reserved memory?