Little more info would be helpful, what is your system setup? Windows 7, 10, otherwise? What graphic card do you have? Does this problem happen anywhere else? How much memory do you have?
Couple of ideas:
This problem could well be from malware. Run a virus and malware scan using Malwarebytes.
You must be registered to see the links
Check to see if there is bloatware running in the background. Apps like Dropbox and Discord are performance killers because they check for updates in the background. Java programs can also end up draining all of the available ram.
Update all of the drivers from safe sources, and by safe source I mean Microsoft or the hardware manufacturer.