On Thu, 11 Jul 2002, Terry Tremaine wrote:
> Hi
>
> The results of 'swapon -s' is:
> Filename Type Size Used Priority
> /dev/hda5 partition 1118840 0 -1
>
> I tried piling up lots of applications and drove up the physical memory usage
> to 100% without any swap activation at all.
>
Hmm, try this little program:
--- Start of listing ---
#include <stdio.h>
#include <stdlib.h>
// Create a block of memory 1K in size
struct memblock {
struct memblock *next;
char nothing[1022];
};
int crash(void);
main()
{
printf("%d K free\n", crash());
return(0);
}
int crash(void)
{
int count;
struct memblock *head, *current, *next;
// Point to the new
current = head = (struct memblock*) malloc(sizeof(struct memblock));
// If none available, leave
if (head == NULL)
return 0;
count = 0;
do
{
count++;
printf ("Number of blocks: %d \n", count );
current->next = (struct memblock*) malloc(sizeof(struct memblock));
current = current->next;
} while (current != NULL);
current = head;
do
{
next = current->next;
free(current);
current = next;
} while (next != NULL);
return count;
}
--- End of listing ---
Copy and paste the code to a file called crash.c. Then run:
gcc -o crash crash.c
As a normal user, start the crash program with:
./crash
As another user, run 'top' and take a look at the swap usage.
BTW, this could potentially lock up your machine.
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com