From ntakebay@bio.indiana.edu  Fri Nov 26 21:07:09 1999
From: ntakebay@bio.indiana.edu (Naoki Takebayashi)
Date: Fri, 26 Nov 1999 16:07:09 -0500 (EST)
Subject: memory.profile() messes up the vector heap on Alpha/Linux?
Message-ID: <Pine.SOL.4.10.9911261537120.3852-100000@sunflower.bio.indiana.edu>

Hello,
I have been trying to debug a problem with R-0.90.0 (this bug was in
0.65.1, too). The following code results in seg faults.  It doesn't
seg-fault on Linux/intel.

> memory.profile()
> gc()

As long as I don't execute memory.profile(), there is no problem with
garbage collection.  So I think that memory.profile() screws up the
heap in some way.

When it seg-faults, it dies in the function compactPhase() in memory.c,

    while (vfrom < R_VTop) {
        s = BACKPOINTER(*vfrom);
        switch (TYPEOF(s)) {    /* get size in bytes */  /* <- dies here */

it segfaults becuase s becomes a pointer to 0x0, when the while loop is
almost finishing, i.e., vfrom is close to R_VTop (vfrom = 0x20001840ef8
and R_VTop = 0x20001841198).

I tried to see what's going on in do_memoryprofile() in memory.c by
stepping with gdb, but I couldn't see what was going wrong (well, to be
honest, I didn't fully understand what was going on).

I thought someone may have some insights about the problem or strategy to
debug this problem.  I wanted to set some kind of watch point, so the 
gdb breaks when the address 0x20001840ef8 is changed.  But I'm not
really good at gdb yet, so I'm wondering if someone can help.

Thanks,
Naoki

platform alpha-unknown-linux
arch     alpha              
os       linux              
system   alpha, linux       
status   Patched            
major    0                  
minor    90.0               
year     1999               
month    November           
day      22                 
language R                  


Naoki Takebayashi     <ntakebay@bio.indiana.edu>
--- Dept. of Biology, Indiana University, Jordan Hall 142
--- 1001 E. Third St. Bloomington, IN 47405-3700 USA

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


memory.profile() messes up the vector heap on Alpha/Linux?
Naoki Takebayashi