Please tell me C++/Java code which utilize memory more than 70% .
For Example we have 3 Virtual machine and in memory resources we want to test the
memory utilization as per memory resources allocated by user.
Which memory? On a 64 bit platform, a 64 bit process can use far more than 4GB. You'd be filling swap for hours before you hit those limits.
If you want to test "70% of physical RAM", you might discover that you cannot allocate 70% of the 32 bits address space. A significant amount is already claimed by the OS.
Code to utilize memory more than 70%