RosettaCodeData/Task/Memory-allocation/Phix/memory-allocation.phix

6 lines
330 B
Plaintext

atom addr = allocate(512) -- limit is 1,610,612,728 bytes on 32-bit systems
...
free(addr)
atom addr2 = allocate(512,1) -- automatically freed when addr2 drops out of scope or re-assigned
atom addr3 = allocate_string("a string",1) -- automatically freed when addr3 drops out of scope or re-assigned