snow: move scratch buffer from stack to malloced buffer in context