Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
Algebraic.dispose - allows the expression represented by an Algebraic to be collected by the Maple garbage collector
Calling Sequence
void dispose() throws MapleException
Description
The dispose functions allows a Maple expression that is represented by an Algebraic object to be collected by the Maple garbage collector. Once dispose has been called on an Algebraic, it is an error to call any member function other than isDisposed.
Every Algebraic object represents a Maple expression. The Algebraic objects keep the corresponding Maple expression from getting collected by the Maple garbage collector. When the Java garbage collector collects the Algebraic object, the link between it and the Maple expression is broken, and Maple may collect the expression.
In some situations the Java garbage collector may be too slow in collecting the Algebraic objects. When this happens, Maple is unable to reuse the memory and so it must allocate more. Calling dispose on objects that are no longer needed may fix this problem.
Examples
import com.maplesoft.openmaple.*;
import com.maplesoft.externalcall.MapleException;
class Example
{
public static void main( String notused[] ) throws MapleException
String mapleArgs[];
Engine engine;
Algebraic a1;
Numeric n;
int i;
mapleArgs = new String[1];
mapleArgs[0] = "java";
engine = new Engine( mapleArgs, new EngineCallBacksDefault(),
null, null );
for ( i = 0; i < 100000; i++ )
a1 = engine.evaluate( "Array( 1..10^4 ):" );
a1.dispose();
}
n = (Numeric)engine.evaluate( "kernelopts( bytesalloc ):" );
System.out.println( "Total Bytes Alloc: "+n );
Executing this code should produce output similar to the following, with the bytes used messages removed.
Total Bytes Alloc: 6945544
See Also
ExternalCalling/Java/MapleException, OpenMaple, OpenMaple/Java/Algebraic, OpenMaple/Java/Algebraic/isDisposed, OpenMaple/Java/API, OpenMaple/Java/Engine/evaluate, OpenMaple/Java/memory
Download Help Document