bool test_oom_random(void) {
  umm_init();
  corruption_cnt = 0;
  void *ptrs[OOM_PTRS_CNT];

  size_t size = 100;

  while (1) {
    size_t i;
    for (i = 0; i < OOM_PTRS_CNT; i++) {
      size += rand() % 40 - 10;
      ptrs[i] = wrap_malloc(size);
      if (ptrs[i] == NULL) {
        goto out;
      }
    }

    /* free some of the blocks, so we have "holes" */
    for (i = 0; i < OOM_PTRS_CNT; i++) {
      if ((rand() % 10) <= 2) {
        wrap_free(ptrs[i]);
      }
    }
  }
out:

  if (corruption_cnt != 0) {
    printf("corruption_cnt should be 0, but it is %d\n", corruption_cnt);
    return false;
  }

  return true;
}
bool test_oom_random(void) {
  umm_init();
  corruption_cnt = 0;
  void *ptrs[OOM_PTRS_CNT];

  size_t size = 100;

  while (1) {
    size_t i;
    for (i = 0; i < OOM_PTRS_CNT; i++) {
      size += rand() % 40 - 10;
      ptrs[i] = wrap_malloc(size);
      if (ptrs[i] == NULL) {
        goto out;
      }
    }

     
    for (i = 0; i < OOM_PTRS_CNT; i++) {
      if ((rand() % 10) <= 2) {
        wrap_free(ptrs[i]);
      }
    }
  }
out:

  if (corruption_cnt != 0) {
    printf("corruption_cnt should be 0, but it is %d\n", corruption_cnt);
    return false;
  }

  return true;
}