RosettaCodeData/Task/Memory-allocation/Factor/memory-allocation-2.factor

7 lines
158 B
Factor

STRUCT: foo { a int } { b foo* } ;
[
foo malloc-struct &free ! gets freed at end of the current with-destructors scope
! do stuff
] with-destructors