There is no such command to magically free memory. If it's being used, it's probably needed for what router is doing.
Memory might be used by some interfaces or functions (conntrack), so it's possible that disabling interfaces or some functions may free some memory, but that will also break what is router currently doing...
Or it might be memory leak and in that case you should send supout.rif to
support@mikrotik.com, just talking about it here on this forum does nothing, this is user forum not mikrotik support.