Hm... There is no way you could do that. If you do not know how much data your function would allocate, you cannot allocate it in advance. While your function is being executed, it might occur that the heap is full and that it needs to be garbage collected before your function could allocate further data. How do you think this would work if the GC would be disabled?

By the way, it is possible to have C functions that are not interrupted by GC, but only when they allocate nothing - but whenever some new value is made, or something is allocated, there might be a need for GC.

 - Tom