Add function to clear memory pools



<!---
@huboard:{"order":19.5,"milestone_order":37,"custom_state":""}
-->