Firstly, it is a developed application. As you know, this application takes up a lot of resources. So I consider it would be most effective to optimize this program.
Usually for performance problems, we use tools to grab and analyze what's causing it. For your issue, it's your developed application. How to limit the memory/cpu usage for a particular program，I consider that you could set the priority usage of the program or some tools may help you. Please refer to the information in the link below:
Hope this helps and please help to accept as Answer if the response is useful.