Memory allocation: Difference between revisions

Content added Content deleted
(Added Racket code)
(Added Erlang)
Line 488:
# value: [].diverge()</lang>
The above creates an array with an initial capacity of 128 bytes (1 kilobit) of storage (though it does not have any elements). (The Java type name is left-over from E's Java-scripting history and will eventually be deprecated in favor of a more appropriate name.) The array will be deallocated when there are no references to it.
 
=={{header|Erlang}}==
Erlang has memory management. To manually allocate memory in the code, spawn a process of a minimal size. The memory is taken from the heap. Gives a minimum heap size in words.
<pre>
Pid = erlang:spawn_opt( Fun, [{min_heap_size, 1024}] ).
</pre>
The memory is returned when the process dies/is killed.
<pre>
erlang:exit( Pid, kill ).
</pre>
 
=={{header|Factor}}==