Add function to clear memory pools