Use of free() in PIC Microcontroller Programming
free() is always used in combination with malloc(). They both concern dynamic memory on the heap. If you look at section 5.5.7 of the XC8 C Compiler User's Guide:


  Dynamic memory allocation, (heap-based allocation using malloc, etc.) is not supported on any 8-bit device. This is due to the limited amount of data memory, and that this memory is banked. The wasteful nature of dynamic memory allocation does not suit itself to the 8-bit PIC device architectures.


If you set the right, high, level of optimization (presuming you have the standard / pro version of the compiler), the compiler might see when the memory isn't needed anymore and rewrite it if necessary. This is only possible if your code is not too complicated.

With a low level of optimization, the compiler won't recognise this and the variable will behave as normally, its memory will be freed when the function in which it's a local variable returns (as with all variables on the stack). If this is in the main() function or we're talking about a global variable, that means never.