GCJ application runs not too bad with shared libs, but crasheswithstatic libs - seems to be in _Jv_MonitorEnter

Scott Gilbertson scottg@mantatest.com
Sat Nov 23 03:21:00 GMT 2002


> On Fri, 22 Nov 2002, Scott Gilbertson wrote:
> > I commented out the sysconf call in is_mp (so is_mp always returns
false),
> > and the thing seems pretty solid now (i.e., I've hammered at it for
about
> > 10-15 minutes without a crash).  I also made a little C program that
prints
> > the results of the same sysconf call, to see if there's something screwy
> > with my setup, but the little program runs just fine.
>
> It's possible the sysconf call is buggy with threads.  I'd guess your
> little C program isn't multithreaded.
>
> Since sysconf reads /proc, it'll be sensitive to kernel version too.
> Interestingly, GC_get_nprocs avoids it:

I had a look at the GC_get_nprocs code in 3.2.  It also reads /proc/stat,
but it doesn't call sscanf.  Maybe that's the secret.

> #ifdef GC_LINUX_THREADS
> /* Return the number of processors, or i<= 0 if it can't be determined. */
> int GC_get_nprocs()
> {
>     /* Should be "return sysconf(_SC_NPROCESSORS_ONLN);" but that   */
>     /* appears to be buggy in many cases.               */
>     /* We look for lines "cpu<n>" in /proc/stat.            */
> ...
>
> Jeff

Perhaps natObject / is_mp should be modified to either call GC_get_nprocs or
duplicate its code?




More information about the Java mailing list