Peter said:
I am doing a chkdsk on my 1Tb HHD (not the system disk) and I see it's
using 12GB RAM..! The RAM is OCZ DDR3PC312800Inteli7
OCZ3X1600R2LV6GK. Is it normal for a chkdsk to use this much memory?
Peter
I've been working on your problem a bit, and I came up
with an unbelievably complicated solution
I tried a few things first. Like the "testlimit" program,
in an attempt to tie up the RAM and keep chkdsk from getting
it. But while I thought there was a parameter to set how much
RAM testlimit uses, there wasn't one. And in any case, chkdsk is
slightly too aggressive anyway, for that to work.
One of the offhand suggestions I read, was to use a 32 bit
version, or use an environment where it would be working in
a 32 bit space. On my x64 laptop, I saw no difference between using
the "GUI launched" chkdsk versus the "command prompt" way of running
chkdsk. They both used RAM in a significant way. The GUI launched
version, runs inside Explorer, while the command prompt way
runs separately. Made no difference for this problem.
Next, I read about a program called "corflags", which can
set flags on the header of .NET programs. But after getting
a copy of that, it turned out chkdsk isn't the right kind
of program for it.
To tell the files apart, I ended up using "file.exe" from the
GNU coreutils, which would report "PE32" for 32 bit executables
and "PE32+" for 64 bit ones. But the file.exe program,
couldn't report any other header flags.
Next stop, was to get an actual 32 bit version of chkdsk. To
do that, I downloaded a DVD from digitalriver, Win7 SP1 Home Premium x32
and had that do an install inside a virtual machine. I stopped the
install after the copy stage (just after the first reboot), then used
a Ubuntu LiveCD to locate and extract C:\Windows\System32\chkdsk.exe .
That's a 16000 byte file, compared to maybe 36000 bytes for the
64 bit version already on my laptop.
When I ran that, it still didn't stop hogging RAM. I did a bit
more reading, and discovered why. A 64 bit application, running
on a 64 bit OS, can use all the memory. A 32 bit application
running on a 64 bit OS, can use 2GB if LargeAddressAware is not
set, and 4GB if it is set. Since my laptop has 3GB of physical RAM,
I seemed to be seeing that the copy of chkdsk.exe I got from
the 32 bit half-install, had the LargeAddressAware flag set.
That meant locating a copy of "editbin", a program that can
edit executable files and change the header. It's similar in
some ways to "corflags", but is for regular executables.
editbin /largeaddressaware:No chkdsk.exe
What that does, is change the 32 bit application from being
able to grab 4GB, down to 2GB. I didn't do that to the regular
chkdsk on my laptop, but to the copy I "borrowed" from the
32 bit half-install.
I then tested the applications a bit, using my ~110GB partition
containing 3.2 million test files. Now, my machine has 3GB of
RAM, and maybe around 2400MB is as far as an application can
go, without stomping on OS space. I repeated the first run,
to see what impact that has, and the 64 bit version of chkdsk
was able to grab a bit more memory on the second run. So if
reporting results, it pays to "warm up" the OS by doing one
run before gathering statistics.
x64 (greedy gus) runtime 9:04 max_ram 2004MB
x64 (greedy gus) runtime 9:08 max_ram 2276MB <--- used a bit more
Next, I tried the 32 bit version of chkdsk.exe, the one
where I'd used editbin to change the LargeAddressAware flag
in the header.
x32s (slim pickens) runtime 9:07 max_ram 1772MB
On my WinXP x32 machine, I typically see 1800MB as the
practical limit for things like really old Photoshop.
So the 1772 value seems reasonable for the "2GB" type limit.
I also ran the unmodified x32 version, but this test
run was ruined by some background activity. So the
runtime is wrong. The max_ram is still indicative,
that the program would have liked to chew into more RAM.
If I'd had an 8GB machine, it probably would have
grabbed around 3400MB or so. It stopped at 2316MB
because there was no more free memory to be had.
x32 (needs diet) runtime 11:09 max_ram 2316MB
So for the "least RAM hungry" solution, getting a
32 bit version of chkdsk from a 32 bit install, plus
using editbin to turn off LargeAddressAware, does
the best job possible.
The other thing I found comical, was the 32 bit and 64 bit
applications, didn't give the same results! Earlier today,
when I did a run with the 32 bit one, it found a couple
files with an "index problem". Running the 64 bit version
immediately afterwards, shows no such problem. The two
"damaged" files appeared to be associated with the AV software.
So it probably wasn't a real difference, but some interaction
between what the AV was doing, versus what chkdsk was doing.
The runs I report above, had no repeat of that (all had no
errors found), so the problem "disappeared" on its own.
HTH,
Paul