This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PCH, and more generally C++ parser performance


Watch out for madvise.  If you use it on Solaris, and peculiar things
happen, it might be best to turn it off and forget it.

Many years ago I worked on the predecessor of Mathematica, called SMP,
which ran on several operating systems and used a mark-and-sweep garbage
collector.  On BSD-related systems, like SunOs, it used the madvise
system call (then called vadvise on Sun) to warn the paging system about
the upcoming behaviors in the mark and sweep phases.  It turned out that
one of the settings had a bug that caused memory to be scribbled, and
while I could prove (by commenting out the vadvise calls) that the fault
was in the code triggered by one setting of vadvise, I could not produce
a small test case for Sun.  It's sufficiently obscure that it may never
have been fixed.  I spent over a week trying to nail it down.  The
overall symptom was that on an unloaded machine, you could repeatedly
run a process doing a particular 10-minute computation, and either get
the right answer, the wrong answer, or a core dump in a seemingly random
fashion.  The only useful thing the debugger told me was that things
went haywire during garbage collection -- running the debugger was
almost useless because every memory location you examined changed the
paging behavior, producing different results.  Until I was inspired to
try commenting out the vadvise calls, the debugger only made me more and
more confused.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]