In MacOsx, we can clean memory through Terminal, like this page show http://www.electrictoolbox.com/purge-free-inactive-memory-mac-osx/ We can enter "purge" commandLine in Terminal.
Then, in a non-jailbreak iOS, how can we do that programmatically?
purge is not the tool you think it is. It flushes the disk cache. This is something you typically never ever want to do in practice. It certainly does not "clean memory". The purpose of
purge is to simulate cold boot conditions so you can do performance testing.
That said, no, you can't do this on iOS.