majid hajibaba majid hajibaba - 1 month ago 17
Linux Question

resize physical memory in linux

I wanna to test a program in a system with 512MB memory. But my system has 1GB RAM slot. I don't want use VM or docker. How can I decrease physical system memory in linux by commands such that

free -m
and
top
commands show the 512MB size for memory.

I do it before but forget that and cannot find it again.

Answer

The mem kernel parameter will allow you to limit the maximum amount of physical RAM visible to the kernel.

kernel=... mem=512M ...
Comments