example on allocation and external functions