Not entirely sure how useful this is given that currently when the mempool is reduced in size, the memory is not yet freed - perhaps this can come in a later pull request.
It's WIP as currently it doesn't work from bitcoin-cli - and I don't quite know why! (can someone help please? it works from within the console of the GUI though).