Memory allocation: Difference between revisions

no edit summary
m (→‎{{header|REXX}}: added wording.)
No edit summary
Line 917:
11399 pages in heap but not gc'd + pages needed for gc marking
131072 maximum pages</lang>
 
=={{header|Nanoquery}}==
Even though the Nanoquery interpreter is implemented in Java, it is possible to use the native library to directly allocate and access memory located off the heap. In this example, 26 bytes are allocated, filled with the uppercase alphabet, then output to the console.
<lang nanoquery>import native
 
// allocate 26 bytes
ptr = native.allocate(26)
 
// store the uppercase alphabet
for i in range(0, 25)
native.poke(ptr + i, ord("A") + i)
end
 
// output the allocated memory
for i in range(0, 25)
print chr(native.peek(ptr + i))
end
 
// free the allocated memory
native.free(ptr)</lang>
{{out}}
<pre>ABCDEFGHIJKLMNOPQRSTUVWXYZ</pre>
 
=={{header|Nim}}==
Anonymous user