Dynamic changing memory limitation

I am looking for a approach that can change memory limitation dynamically and works on-the-fly. Is seems changing cgroup works. However, I am wondering is this the only approach? are there any tools or command could do this? Thanks

Refer

Also refer

and

https://goldmann.pl/blog/2014/09/11/resource-management-in-docker/#_changing_the_shares_value_for_a_running_container