Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit RAM Usage to a CPP application

Tags:

ram

I have 3 GB RAM. Is there a way to allocate only 512MB of RAM to a C++ application?

Else

Is there a way to reduce my RAM to 512MB for a while for testing purpose?

Thanks, Ashok

like image 357
Ashok G Avatar asked Jul 22 '26 17:07

Ashok G


1 Answers

Use SetProcessWorkingSetSize()

Sets the minimum and maximum working set sizes for the specified process.

like image 139
Reno Avatar answered Jul 28 '26 15:07

Reno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!