coopth: cache per-thread stack to avoid many malloc()/free() cycles