0

Virtual memory verification

Hi I was asked to verify the concept that we do have virtual memory. To prove that , I thought we will have process memory allocated, but how to get this idea. If this is known , should I create large class objects which need more than available memory. Any suggestions are most welcome.

4th Feb 2025, 11:09 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 odpowiedzi
+ 2
You would need to compile and run the test program on a local machine where you know how much physical memory is installed (as opposed to here which runs on Sololearn servers). From there, you could create a filler class, use sizeof() to measure how many bytes it needs, then create an array of that class such that the total size would be bigger than either: A) Max physical memory allocatable per process B) Total physical memory available
5th Feb 2025, 6:34 AM
Shardis Wolfe
+ 1
Ketan Lalcheta as you can see that the Playground environment here has a memory allocation limit somewhere between 1GB (1024MB) and 2GB (2048MB). It's also highly likely there's a timeout in place which most of us already know is relatively short. https://sololearn.com/compiler-playground/cnyGh8M5SQf9/?ref=app
5th Feb 2025, 12:46 AM
BroFar
BroFar - avatar
5th Feb 2025, 6:32 AM
Bob_Li
Bob_Li - avatar