Memory allocation: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: added more verbage in the REXX section header. -- ~~~~) |
(Added Racket code) |
||
Line 964: | Line 964: | ||
x=vector("numeric",10) #same as x=numeric(10), space allocated to list vector above now freed |
x=vector("numeric",10) #same as x=numeric(10), space allocated to list vector above now freed |
||
rm(x) # remove x</lang> |
rm(x) # remove x</lang> |
||
=={{header|Racket}}== |
|||
Racket doesn't allow direct memory allocation, although it supports some things |
|||
<lang Racket>#lang racket |
|||
(collect-garbage) ; This function forces a garbage collection |
|||
(current-memory-use) ;Gives an estimate on the memory use based on the last garbage collection |
|||
(custodian-require-memory <limit-custodian> |
|||
<amount> |
|||
<stop-custodian>) ; Registers a check on required memory for the <limit-custodian> |
|||
; If amount of bytes can't be reached, <stop-custodian> is shutdown |
|||
(custodian-limit-memory <custodian> <amount>) ; Register a limit on memory for the <custodian></lang> |
|||
Custodians manage threads, ports, sockets, etc. |
|||
A bit of information about them is available [http://docs.racket-lang.org/reference/eval-model.html?q=memory&q=custodian&q=computer&q=pointer#%28part._custodian-model%29 here] |
|||
=={{header|Retro}}== |
=={{header|Retro}}== |