Beispiel #1
0
void MemFreeListPrint(FILE* out)
{
    long i, sum =0, count=0, tmp;

    fprintf(out, "# MemFreeListPrint()\n");
    fprintf(out, "# ===============================\n");
    for(i=0; i< MEM_ARR_SIZE; i++)
    {
        tmp = free_list_size(free_mem_list[i]);
        if(tmp)
        {
            fprintf(out, "# %4ld: %ld\n", i+sizeof(MemCell), tmp);
            sum += tmp*(i+sizeof(MemCell));
            count += tmp;
        }
    }
    fprintf(out, "# ===============================\n");
    fprintf(out, "# %6ld blocks with %ld bytes \n", count, sum);
}
Beispiel #2
0
// check
static bool check_sizes(rba_buffer_t *b) {
  uint32_t s;

  s = tree_size(b);
  if (s != b->nterms) {
    printf("invalid tree: size = %"PRIu32", nterms = %"PRIu32"\n", s, b->nterms);
    fflush(stdout);
    return false;
  }

  s = free_list_size(b);
  if (s != b->num_nodes - b->nterms - 1) {
    printf("invalid free list: size = %"PRIu32", should be %"PRIu32"\n",
	   s, b->num_nodes - b->nterms - 1);
    fflush(stdout);
    return false;
  }

  return true;
}