Memory allocation: Difference between revisions

Line 926:
# Allocate memory block on shared heap
var b = allocShared(1000)
deallocShared(b)</lang>
 
var p = create(int, sizeof(int)) # allocate a single int
# create zeroes memory; createU does not.
echo p[] # 0
p[] = 123 # assign a value
echo p[] # 123
discard resize(p, 0) # deallocate it
# p is now invalid. Let's set it to nil
p = nil # set pointer to nil
echo isNil(p) # true
</lang>
 
=={{header|Objeck}}==
Anonymous user