How can I request Java garbage collection in the Java Virtual Machine (JVM) in MATLAB 7.3 (R2006b)?

13 visualizaciones (últimos 30 días)
I would like to request Java garbage collection in the Java Virtual Machine (JVM) in MATLAB 7.3 (R2006b).

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Jun. de 2009
While it is not possible to force the Java VM to release memory of de-referenced objects, you can request that the JVM performs garbage collection. This may result in the desired memory being released. Issue the following command from the MATLAB command prompt:
java.lang.System.gc()
Another method to request Java garbage collection is to create a Java Runtime object and call its 'gc' method. This can be done at the MATLAB command prompt with:
java.lang.Runtime.getRuntime().gc
Garbage collection is run as separate thread in the JVM. The garbage collector (GC) runs as Java priority 1 (the lowest priority). The virtual machine, VM, runs at Java priority 10 (the highest priority). In most cases, the GC runs during idle times, generally when the VM is waiting for user input or when available memory is low. In the latter case, the GC interrupts high-priority processing in the application in order to free memory.

Más respuestas (0)

Categorías

Más información sobre Java Package Integration en Help Center y File Exchange.

Productos


Versión

R2006b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by