Wednesday, July 18, 2007

Heap size limitation on Windows

For 32 bit Windows systems, the OS support 2GB address space. However, the maximum leap size that a JVM can allocate is less than 2GB. This is caused by the way the JDK DLLs are rebased.

For JDK1.3, the heap size is around 1.2GB. Here is a dump of the DLL layout for JDK1.3.0 using listdlls.exe

Base Size Path
0x00400000 0x5000 d:\jdk1.3\bin\java.exe
0x503f0000 0x10b000 d:\jdk1.3\jre\bin\hotspot\jvm.dll
0x50220000 0x7000 d:\jdk1.3\jre\bin\hpi.dll
0x50380000 0xd000 d:\jdk1.3\jre\bin\verify.dll
0x50250000 0x17000 d:\jdk1.3\jre\bin\java.dll
0x50390000 0xd000 d:\jdk1.3\jre\bin\zip.dll
0x6bd00000 0x21000 C:\WINNT\System32\cwbaudll.dll
0x77f60000 0x5e000 C:\WINNT\System32\ntdll.dll
0x77dc0000 0x3f000 C:\WINNT\system32\ADVAPI32.dll
0x77f00000 0x5e000 C:\WINNT\system32\KERNEL32.dll
0x77e70000 0x54000 C:\WINNT\system32\USER32.dll
0x77ed0000 0x2c000 C:\WINNT\system32\GDI32.dll
0x77e10000 0x57000 C:\WINNT\system32\RPCRT4.dll
0x78000000 0x40000 C:\WINNT\system32\MSVCRT.dll
0x77fd0000 0x2a000 C:\WINNT\System32\WINMM.dll


So that leaves 0x50000000 - 0x00400000 = 1276MB contiguous address space. Run the following command:
rebase.exe -b 0x6D000000 \jdk1.3\jre\bin\*.dll \jdk1.3\jre\bin\hotspot\jvm.dll

It will increase the heap size to around 1.65GB.

Compare that to the listdlls output for jdk1.5, which allows around 1.45GB heap size (with JDK1.4.2, -Xmx1200M is the maximum)
0x00400000 0xc000 5.00.0040.0005 D:\jdk1.5\bin\java.exe
0x6d6b0000 0x189000 5.00.0040.0005 D:\jdk1.5\jre\bin\client\jvm.dll
0x6d2f0000 0x8000 5.00.0040.0005 D:\jdk1.5\jre\bin\hpi.dll
0x6d680000 0xc000 5.00.0040.0005 D:\jdk1.5\jre\bin\verify.dll
0x6d370000 0x1d000 5.00.0040.0005 D:\jdk1.5\jre\bin\java.dll
0x6d6a0000 0xf000 5.00.0040.0005 D:\jdk1.5\jre\bin\zip.dll


rebase.exe is from Visual Studio.
listdlls.exe is from http://www.microsoft.com/technet/sysinternals/default.mspx.

4 comments:

ninest123 said...

burberry, tory burch outlet, jordan shoes, sac longchamp, uggs on sale, ugg boots, louis vuitton, oakley sunglasses, michael kors, tiffany jewelry, cheap oakley sunglasses, ray ban sunglasses, christian louboutin outlet, ralph lauren pas cher, louboutin pas cher, ray ban sunglasses, air max, nike free, longchamp outlet, longchamp pas cher, ray ban sunglasses, tiffany and co, oakley sunglasses, polo ralph lauren outlet, louis vuitton, prada outlet, kate spade outlet, longchamp outlet, nike free, ugg boots, nike air max, gucci outlet, oakley sunglasses, louis vuitton outlet, longchamp, nike outlet, replica watches, louis vuitton, replica watches, prada handbags, chanel handbags, louboutin outlet, oakley sunglasses, nike roshe run, louis vuitton outlet, nike air max, louboutin shoes, louboutin, polo ralph lauren outlet, air jordan pas cher

ninest123 said...

true religion jeans, hollister pas cher, vans pas cher, tn pas cher, michael kors, true religion outlet, sac guess, nike free run uk, michael kors outlet, oakley pas cher, true religion jeans, replica handbags, ugg boots, burberry outlet online, mulberry, converse pas cher, michael kors outlet, ugg boots, true religion jeans, michael kors outlet, michael kors, nike air max, air force, hogan, new balance pas cher, vanessa bruno, ray ban uk, hollister, kate spade handbags, north face, nike air max, lululemon, coach outlet, burberry, michael kors, timberland, ray ban pas cher, michael kors outlet, coach purses, lacoste pas cher, hermes, nike air max, nike blazer, north face, ralph lauren uk, abercrombie and fitch, michael kors outlet, michael kors, nike roshe, coach outlet

ninest123 said...

converse outlet, giuseppe zanotti, hollister, insanity workout, herve leger, north face outlet, asics running shoes, nike air max, louboutin, converse, instyler, vans shoes, reebok shoes, iphone cases, abercrombie and fitch, mac cosmetics, wedding dresses, nike huarache, baseball bats, p90x workout, valentino shoes, chi flat iron, nike trainers, ghd, babyliss, oakley, soccer shoes, vans, timberland boots, gucci, celine handbags, nike air max, north face outlet, new balance, ralph lauren, hollister, jimmy choo shoes, mcm handbags, birkin bag, soccer jerseys, longchamp, beats by dre, bottega veneta, ferragamo shoes, nfl jerseys, lululemon, nike roshe, hollister, mont blanc, ray ban

ninest123 said...

moncler, lancel, canada goose, moncler outlet, canada goose, louis vuitton, juicy couture outlet, swarovski crystal, sac louis vuitton pas cher, louis vuitton, canada goose outlet, moncler, moncler, moncler, pandora charms, montre pas cher, canada goose uk, ugg,ugg australia,ugg italia, hollister, canada goose, ugg,uggs,uggs canada, bottes ugg, marc jacobs, doudoune canada goose, ugg boots uk, moncler, louis vuitton, moncler, pandora jewelry, thomas sabo, pandora charms, toms shoes, barbour, coach outlet, supra shoes, replica watches, links of london, barbour jackets, canada goose, juicy couture outlet, swarovski, pandora jewelry, canada goose outlet, louis vuitton, moncler, karen millen, wedding dresses, ugg pas cher