Can anyone help?
Listed below is some code(Microsoft Visual C++)
It calc's the maximum allocation
that succeeds. Why does it only return 255 Mb?
Can anyone tell me how to allocate 600Mb
(Need for large image processing) ?
#include <stdio.h>
#include <malloc.h>
// windows 95
// swap file min 512Mb max 1019Mb
// free space 1019Mb
// maximum allocation that succeeds is 255 Mb
// WHY WHY WHY
void main()
{
unsigned int size;
char *buff;
size = 2048;
buff = NULL;
while (buff == NULL)
{
size -= 1;
printf ("try allocation of %d Mb\n", size);
buff = (char *) malloc(size * 1024 * 1024);
}
if (buff)
{
printf ("largest allocation is %d Mb\n", size);
printf ("freeing allocation\n", size);
free (buff);
}
else
{
printf ("no allocations succeded\n");
}
Quote:
}