| 1 |
|
|---|
| 2 | char *
|
|---|
| 3 | test_malloc2 (void)
|
|---|
| 4 | {
|
|---|
| 5 | int const amt = 1024 * 1024;
|
|---|
| 6 | int i = 0;
|
|---|
| 7 | // while (memset (malloc (amt), 0, amt))
|
|---|
| 8 | while (malloc (amt))
|
|---|
| 9 | {
|
|---|
| 10 | ++i;
|
|---|
| 11 | if (i % 10)
|
|---|
| 12 | printf ("%d\n", i);
|
|---|
| 13 | }
|
|---|
| 14 | printf ("Allocated %d chunks of %dB\n", i, amt);
|
|---|
| 15 |
|
|---|
| 16 | return NULL;
|
|---|
| 17 | }
|
|---|