Arena storage pool: Difference between revisions
Content added Content deleted
(Added Kotlin) |
mNo edit summary |
||
Line 412: | Line 412: | ||
That said, using J's built-in support for integers (and for using them) usually results in better code. |
That said, using J's built-in support for integers (and for using them) usually results in better code. |
||
=={{header|Julia}}== |
|||
All program elements in Julia are dynamically allocated objects which are garbage collected |
|||
as required after they are out of scope. If a specific storage pool is needed in advance, perhaps for |
|||
performance reasons, the pool can be optionally preallocated as an array or other large structure. |
|||
For example, a large 1000 X 1000 X 1000 matrix that will need to be changed repeatedly might be |
|||
allocated and initialized to zero with: |
|||
<lang julia> |
|||
matrix = zeros(Float64, (1000,1000,1000)) |
|||
# use matrix, then when done set variable to 0 to garbage collect the matrix: |
|||
matrix = 0 # large memory pool will now be collected when needed |
|||
</lang> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |