No result at all in v0.6



Memprof starts with its GUI, but it is completely empty. Nothing happens
when I press the Profile and Leak buttons! I have tried with different
test programs inclusive testmemprof. However, I noticed some error
messages when memprof was starting up: mi_write error <number>. Where
number was different for different runs. These messages are printed by
the function:

  int mi_write (int fd, const void *buf, int total)

defined in the file memintercept-utils.c:255.

I changed this line from:
  mi_debug ("mi_write error %d\n", errno);
to:
  mi_perror ("mi_write error");
To get better error messages. Now I got something about Bad Address or
Broken Pipe and Bad File Descriptor.

Then I printed out the total parameter to the above function and I got
some eight-nine figures numbers, i.e. it tried to write very large
buffers! I tracked these calls to the function:

  void mi_write_stack (int n_frames, void **frames, void  *data)

in the file intercept.c:365.

It turned out to be some requests to write very large stacks of about 3
millions frames! This only occurred early in the run and just a few (5?)
times. There is in this function a test to avoid writing stacks with a
negative number of frames. I changed this test so it only writes
reasonable sized stacks (less than 10000 frames) and now memprof seems
to work, at least most of the times. I guess these bad request are a bit
random and sometimes they are reasonable sized so they slip through the
test, but still bad.

Change the first line of:
  if (n_frames < 0) {
    MI_DEBUG (("mi_write_stack - elide bogus foo\n"));
    return;
  }

To:
  if (n_frames < 0 || n_frames>10000) {

Maybe this can be some help for others trying to use memprof and
hopefully for someone to do a real analysis and fix of the problem. I'm
not sure if the results produced, when available, are correct! But at
least the test program seems to give correct results.

--
chb




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]