' Heap operations: HEAPALLOC, HEAPFREE, HEAPNEW, HEAPSIZE, HEAPAVAIL
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL hHeap  AS LONG
    LOCAL p  AS LONG
    LOCAL hSize  AS LONG
    PRINT "HEAPAVAIL before alloc:"; HEAPAVAIL

    hHeap = HEAPNEW(4096)
    PRINT "HEAPNEW(4096):"; hHeap

    p = HEAPALLOC(hHeap, 256)
    PRINT "HEAPALLOC(256):"; p
    hSize = HEAPSIZE(p)
    PRINT "HEAPSIZE(p):"; hSize

    PRINT "HEAPAVAIL now:"; HEAPAVAIL
    PRINT "Heap operations complete."

    FUNCTION = 0
END FUNCTION
