mem() function to run gc and return free heap