I think a Matlab forum would be best but

Matlab itself is in control of what memory it calls for. Also it's up to Matlab to tap extra CPUs if this is a multi-core system.

Back to Matlab?

And there is little reason for me to duplicate prior discussions such as https://www.google.com/search?hl=en&as_q=optimizing+matlab+performance EXCEPT for one thing. Be sure your Matlab is current. One encounter left me shaking my head as they had a 10 year old version and were complaining.
Bob