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.
3 Respuestas
+ 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
+ 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
+ 1
if you're on windows, perhaps this link could be useful
https://learn.microsoft.com/en-us/windows/win32/memory/reserving-and-committing-memory
https://cplusplus.com/forum/windows/67748/