/* Combining the pointer-transferring buffer and the memory manager */ tl; init() { f = NULL; c = NULL; } resource mm (f) [list(f)] alloc(x;) { with mm when(true) { if(f==NULL) x = new(); else { x = f; f = x->tl; }} } [x|->] dealloc(y) [y|->] { with mm when(true) { y->tl = f; f = y; } } resource buf (c) [if c==NULL then emp else c|->] put(x) [x|->] { with buf when (c==NULL) { c = x; } } [emp] get(y;) [emp] { with buf when (c!=NULL) { y = c; c = NULL; } } [y|->] putter() { local x; alloc(x;); put(x); putter(); } getter() { local y; get(y;); /* use y */ dealloc(y); getter(); } main() { putter() || getter(); }