data.d

Vladimir Panteleev vladimir at thecybershadow.net
Thu Jul 15 16:22:52 PDT 2010


On Fri, 16 Jul 2010 02:20:16 +0300, Vladimir Panteleev  
<vladimir at thecybershadow.net> wrote:

> Does this 2 or 3GB limitation only affect 32-bit operating systems? On  
> my 64-bit Windows, with /LARGEADDRESSAWARE, a simple program can do  
> close to 64K (65062 for me) 1-byte VirtualAllocs.

Said simple program in case anyone wants to test, excuse the C:

#include <windows.h>
#include <stdio.h>

#define N (64*1024)

void main()
{
	int i;
	char s[10];

	gets(s);
	for (i=0; i<N; i++)
	{
		void *p = VirtualAlloc(NULL, 1, MEM_COMMIT, PAGE_READWRITE);
		if (p==NULL)
		{
			printf("Allocation failed at %d\n", i);
			break;
		}
		*(char*)p = 17;
		if (i==0 || i==N-1 || p==NULL)
			printf("%p\n", p);
	}
	gets(s);
}

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d-announce mailing list