Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 2 GB virtual memory limit in Windows

Author: Eugene Nalimov

Date: 20:29:30 08/29/05

Go up one level in this thread


On August 29, 2005 at 23:12:24, Lance Perkins wrote:

>On August 29, 2005 at 19:18:32, Vincent Diepeveen wrote:
>
>>On August 29, 2005 at 16:13:58, Marc Bourzutschky wrote:
>>
>>>What are the options to be able to access more than 2 GB of memory in XP Pro?
>>>Does the /3G boot option work in XP Pro, and if so, are special tweaks needed by
>>>applications?  Are there other options?  I'm trying to have more memory
>>>available for myself of the 4 GB I have installed on my machine...
>>>
>>>Thanks,
>>>Marc
>>
>>Perhaps install linux, has more advantages with respect to memory.
>>Windows i cannot recommend for software that wants to use more than 480MB ram.
>>
>>Vincent
>
>I'm not sure where you got that 480MB limit.
>
>C:\Temp\Test>ver
>
>Microsoft Windows [Version 5.2.3790]
>
>C:\Temp\Test>type test.cpp
>#include <windows.h>
>#include <stdio.h>
>#include <stdlib.h>
>void main (void)
>{
>    // allocate 768 MB
>    #define N (1024 * 1024 * 768)
>    char *p = (char*) GlobalAlloc (GMEM_FIXED, N);
>    if (p == NULL)
>        puts ("failed");
>    else {
>        CopyMemory (p, p + (N / 2), N / 2);
>        puts ("ok");
>        GlobalFree ((HGLOBAL) p);
>    }
>}
>
>C:\Temp\Test>cl -nologo -Ox test.cpp
>test.cpp
>
>C:\Temp\Test>test
>ok
>
>C:\Temp\Test>

And here is another small program, run on system booted up with /3Gb switch:

  #include <stdlib.h>

  main()
  {
      int n = 0;

      while (malloc(10 * 1024 * 1024))
          n ++;
      printf ("Allocated %dMb of memory\n", n * 10);
      return 0;
  }

Compiling it:

  C:\repro>cl /Ox test.c /link /largeaddressaware
  Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50317 for 80x86
  Copyright (C) Microsoft Corporation.  All rights reserved.

  test.c
  Microsoft (R) Incremental Linker Version 8.00.50317
  Copyright (C) Microsoft Corporation.  All rights reserved.

  /out:test.exe
  /largeaddressaware
  test.obj

And now running it:

  C:\repro>test
  Allocated 3020Mb of memory

Thanks,
Eugene



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.