Ram and cpu control using Grasshopper


Hello sir,
Is there any way that can control system RAM and CPU usage while running Grasshopper script,
Because most of the time it says “not responding”.
May be in my script has some problem in logic or data management,
I just thought if there is any way to control ram and cpu to get rid of crash.
Please help me if there is any way.

(System configuration:- RAM 16 GB, CPU I7 10TH GEN, NORMAL SSD, WITHOUT GPU)