IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4498


Ignore:
Timestamp:
Jul 7, 2005, 5:40:33 AM (21 years ago)
Author:
eugene
Message:

better reporting on free failures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/src/ohana_allocate.c

    r4300 r4498  
    156156  }
    157157
    158   ohana_memabort ("allocated memory not found for free (%s, %d)\n", file, line);
     158  /* find already freed examples */
     159  for (i = 0; i < Nmemlist; i++) {
     160    if (memlist[i].ptr == in) {
     161      fprintf (stderr, "used here: %4d %s %d\n", i, memlist[i].file, memlist[i].line);
     162    }
     163  }
     164
     165  ohana_memabort ("allocated memory not found for free (%s, %d : %x)\n", file, line, in);
    159166  return;
    160167}
     
    234241    Ns[N] ++;
    235242    if ((allmemory == 0) && (memlist[i].state == STATE_FREE)) continue;
    236     fprintf (stderr, "%3d %4d %c %s %d\n", Ns[N], i, S[N], memlist[i].file, memlist[i].line);
     243    if (memlist[i].state == STATE_EXTERNAL) {
     244      fprintf (stderr, "%3d %4d %x : %x - external (external external) %c %s %d\n",
     245               Ns[N], i, memlist[i].ptr, memlist[i].ptr,
     246               S[N], memlist[i].file, memlist[i].line);
     247    } else {
     248      fprintf (stderr, "%3d %4d %x : %x - %x (%x %x) %c %s %d\n",
     249               Ns[N], i, memlist[i].ptr, (memlist[i].ptr - 4), (memlist[i].ptr + memlist[i].size + 4),
     250               *(long *)(memlist[i].ptr - 4), *(long *)(memlist[i].ptr + memlist[i].size),
     251               S[N], memlist[i].file, memlist[i].line);
     252    }
    237253  }
    238254  fprintf (stderr, "Nused: %d (Nalloc: %d, Nrealloc: %d), Nfree: %d\n",
Note: See TracChangeset for help on using the changeset viewer.