The question is pretty undefined. The function itself will occupy only space for its activation record from the caller, for parameters and for its local variables on the stack. According to the architecture, the activation record will contain such things as stored registers, address to return when the function is called, etc.
But a function can allocate how much memory is needed on the heap, so there is no exact answer.
Oh, in addition, if the function is recursive, then it can use a lot of memory, always because of the activation records that are needed between each call.
source share