How can I request Java garbage collection in the Java Virtual Machine (JVM) in MATLAB 7.3 (R2006b)?
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I would like to request Java garbage collection in the Java Virtual Machine (JVM) in MATLAB 7.3 (R2006b).
Risposta accettata
MathWorks Support Team
il 27 Giu 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.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Java Package Integration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!