Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / How do I find out how much RAM is available, then set it as a variable?

Author
Message
The Zombie Killer
14
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 5th Feb 2012 09:12
Hey guys,
I'm just trying to find out how I can, at the DOS prompt, find out how much memory my computer has in megabytes, then set it as a variable, for example:
echo off
cls
findoutram /var pcram
echo %pcram%

which would output something like 2048.
Any help would be appreciated.

-TZK

YoYo Games Account
Predator drone for FPSC - Coming soon, maybe
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Feb 2012 09:44
It's a tough one ...

MEM

The Zombie Killer
14
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 5th Feb 2012 10:04
@batvink
I am aware of that command, but I am using win7, and win7 doesn't have that command, also I want to write the result in megabytes to a variable.

-TZK

YoYo Games Account
Predator drone for FPSC - Coming soon, maybe
Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 5th Feb 2012 10:27
If you want megabytes and have bytes, divide by 1024/1024
The Zombie Killer
14
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 5th Feb 2012 10:41
@Isocadia
The problem is, I don't have the mem command, and the mem command doesn't write the memory amount to a variable.
If anyone wants to know I'm trying to do this:
java -Xmx%pcram%M -Xms%pcram%M -cp "%cd%\mupdata\mclogo.jar";"%cd%\minecraft.jar"

It speeds up minecraft HEAPS when it uses the full memory amount, using this method also launches MC in 64bit java if you have it installed.

-TZK

YoYo Games Account
Predator drone for FPSC - Coming soon, maybe
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Feb 2012 21:26
Uh, you do realise that you can never set it to use the "full" memory amount. A significant fraction of memory will always be required by the OS just to keep track of the rest of the memory, then you have to take into account all the other processes on your system which all use memory. If java tries to use all the memory you've given it, the OS will have to constantly page out parts of the memory to disk (very slow) so that it can pretend that you actually have more memory than you do.

[b]
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Feb 2012 21:32
Quote: "I am aware of that command, but I am using win7, and win7 doesn't have that command"


I ran that test on Win 7, it worked fine here. But as Diggsey says, there's more to it than that. If you fiddle with the memory rather than use the configuration provided by the developer you run the risk of garbage collection issues, and especially a Stop The World gc.

bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 5th Feb 2012 21:48 Edited at: 5th Feb 2012 21:54
win7 x64 doesn't have that command.

You could always write a program to output the available memory to the command line.

You're better off manually tuning it though.

The Zombie Killer
14
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 6th Feb 2012 07:17
@Diggsey
I thought about that for a bit today, and decided that I can just make it output available memory instead of the max.

-TZK

YoYo Games Account
Predator drone for FPSC - Coming soon, maybe

Login to post a reply

Server time is: 2025-05-19 17:56:08
Your offset time is: 2025-05-19 17:56:08