Skip to content

help debugging segfaults

3 messages · Liaw, Andy, Duncan Murdoch, Thomas Lumley

#
Hi all,

Thanks to Prof. Ripley, Prof. Gentleman, and Simon Wood (did I miss
anyone?).  The problem seemed to have gone away.

Everyone suggested using some malloc debugger (such as Electric Fence).  All
I did was following half of what BDR suggested below, i.e., changing all the
S_alloc() calls to Calloc() and Free().  I didn't get to try efence, and the
problem seems to have disappeared!

As I read it from the R-exts manual, the difference between S_alloc and
Calloc is that S_alloc takes memory from the heap, whereas Calloc takes
memory addtional to the heap.  So can anyone explain what's going on?  It's
still kind of mysterious to me...

Again, thanks very, very much for the help!

(Some day I might try to use .Call rather than .C, but I think I need to get
a bit more familiarity with .Call on simpler things before I try it with
randomForest.)

Regards,
Andy
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 13 Jun 2002 08:38:32 -0400, you wrote in message
<51F9C42DA15CD311BD220008C707D81906FFC35C@usrymx10.merck.com>:
In my experience, that's not such good news.  The bug is probably
still there, it just doesn't have obvious symptoms in the tests you're
using.  I'd still recommend using the malloc debugger to try to track
it down.

Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 13 Jun 2002, Liaw, Andy wrote:
No, the *symptoms* have disappeared. This is not necessarily an
improvement.
It looked as if your code was writing to/reading from memory that didn't
belong to it. What happens then depends on who the memory does belong to,
and what they are doing with it. There's no guarantee that just because it
doesn't crash today that it won't in the future, or worse, start giving
subtly wrong answers.

A segmentation fault is a good thing in this context -- it's a sign that
the operating system has protected you from the consequences of your
actions by killing the program.

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._