In any case, an implementation along the lines of tprivalloc seems ok, and passes my naive test program.