Re: using more physical memory?

From: Chris Kantarjiev (cak+news_at_dimebank.com)
Date: 06/21/05


Date: Tue, 21 Jun 2005 11:42:15 -0700

And, if anyone wants to experiment, here's my little program:

*** 340 % cat glutton.c
#include <stdio.h>
#include <stdlib.h>

#define KB (1024)
#define MB (1024*KB)
#define CHUNK 1*MB
main()
{
         void *p;
         long int size = 0;

         do {
             p = malloc((size_t) CHUNK);
             if (p != NULL)
                 size += CHUNK;
         } while (p != NULL);
         printf("chunk: %d MB, final size: %d KB %d MB\n",
                 CHUNK/MB,
                 size/KB,
                 size/MB);
}


Quantcast