malloc.c 352 B

1234567891011121314
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. static const size_t sizes[] = { 16, 32, 64, 128, 256, 512 };
  4. int main(int argc, char** argv) {
  5. for (int i = 0; i < 100000; i++) {
  6. for (int j = 0; j < sizeof(sizes) / sizeof(sizes[0]); j++) {
  7. if (!malloc(sizes[j])) {
  8. return 1;
  9. }
  10. }
  11. }
  12. return 0;
  13. }