All we need to add is something like PetscMallocGetStack(void *memorylocation, PetscStack *stack);
Barry On Dec 8, 2012, at 6:32 PM, Barry Smith <bsmith at mcs.anl.gov> wrote: > > Jed, > > Stop, I've decided I don't like this approach, it mixed the low-level > malloc() stuff with the higher level PETSc object stuff. > > We already maintain a list of PetscObjects in the file inherit.c So we > can use the function PetscObjectsView() to print out all the non-destroyed > objects. All we need to do is a add support to PetscObjectsView() to snag the > the stack list for the first malloc in each object (which is created with > PetscMalloc()) and print that out with the object info. Note that > PetscTrMallocDefault() uses PetscStackCopy() which somehow keeps the entire > stack at the malloc, this could be accessed somehow in PetscObjectsView() to > get the stack where the object was malloced. > > Barry > > > > > > > > On Dec 8, 2012, at 6:20 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote: > >> On Sat, Dec 8, 2012 at 4:17 PM, Barry Smith <bsmith at mcs.anl.gov> wrote: >> I was thinking of just marking the first memory allocation for each >> object, like the PetscNew(struct tp,&(h) with a bool (another record in >> TRSPACE), then -malloc_dump_objects would be just like -malloc_dump except >> only dump memory with that mark and hence one dump for each object. Nothing >> fancy but get's the job done. Could have PetscNewMark() used for this >> purpose. >> >> So just mark it with a Bool rather than the classid. That's fine, but the >> extensible malloc interfaces need to be extended to support the extra >> routine. >
