-- OpenEuphoria's std/eumem.e
-- OpenEuphoria's std/eumem.e
Following global variables are defined:
The (pseudo) RAM heap space. Use memAlloc to gain ownership to a heap
location and memFree to release it back to the system.
handle of routine memFree()
Following global procedures are defined:
Deallocate a block of (pseudo) memory
Params:The handle to a previously acquired ram_space location.
This allows the location to be used by other parts of your application. You
should no longer access this location again because it could be acquired by
some other process in your application.
atom my_spot, my_spot2
my_spot = memAlloc("")
my_spot2 = memAlloc(4)
do some stuff ...
memFree(my_spot2)
memFree(my_spot)
memAlloc
Following global functions are defined:
Allocate a block of (pseudo) memory
Params:The initial structure (sequence) to occupy the allocated block.
If this is an integer, a sequence of zero this long is used. The default
is the number 1, meaning that the default initial structure is {0}
A handle, to the acquired block. Once you acquire this, you can use it
as you need to.
atom my_spot, my_spot2
my_spot = memAlloc("")
my_spot2 = memAlloc(4)
ram_space[my_spot] = "to be or not to be"
puts(1, ram_space[my_spot] & "\n")
-- to be or not to be
ram_space[my_spot2] = 1024
? ram_space[my_spot2]
-- 1024
puts(1, ram_space[my_spot] & "\n")
-- to be or not to be
? ram_space[my_spot2]
-- 1024
memFree(my_spot2)
memFree(my_spot)
memFree