Do compilers ever transform pairs of malloc/free? E.g. in a loop: p = malloc(32); foo(p); free(p); In principle this doesn't need to be allocated on the heap.