Memory allocation: Difference between revisions

Added Maple implementation.
(Added zkl)
(Added Maple implementation.)
Line 700:
 
When run using Sun's JVM implementation, the above simply outputs "created". Therefore, you cannot rely on <tt>finalize</tt> for cleanup.
 
=={{header|Maple}}==
Maple is a garbage-collected language, so there is no direct control over the lifetime of objects, once allocated. When an object is allocated, it remains in memory until it is no longer reachable; then it is garbage-collected.
 
You can allocate a large block of memory by creating an Array
<lang Maple>a := Array( 1 .. 10^6, datatype = integer[1] ):
</lang>
Now you can use the storage in the Array assigned to <tt>a</tt> as you see fit. To ensure that <tt>a</tt> is garbage collected at the earliest opportunity, unassign the name <tt>a</tt>:
<lang Maple>unassign( a ):</lang>
or
<lang Maple>a := 'a':</lang>
 
=={{header|Mathematica}}==
Anonymous user