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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Crash in garbage collection(?) under GCC 3.3 & GCC 3.4


Was this ever reproduced on a non-Windows platform?  (I'm trying, so far without luck.)

If not, is DYNAMIC_LOADING defined by gcconfig.h for the Windows build?

A possible issue here is that under win32 the collector often tries to use VirtualQuery
to find writable memory segments outside the heap, which it then scans for pointers.
However at least some versions of Windows asynchronously unmap such segments.  Thus the
collector may fault when it tries to trace them.

If the collector is built with MS tools, it uses structured exception handling to recover.
Under gcc it used to not recover.  Ranjit Mathew contributed code to do this correctly.
It's in gc6.2, but I don't think it's in the gcc trunk.

Hans

> -----Original Message-----
> From: Øyvind Harboe [mailto:oyvind.harboe@zylin.com]
> Sent: Monday, July 21, 2003 12:16 AM
> To: java@gcc.gnu.org
> Subject: Crash in garbage collection(?) under GCC 3.3 & GCC 3.4
> 
> 
> This as Good Old crash still with us. :-)
> 
> I found it while looking for something else, and fortunally it
> doesn't affect my app, but its an interesting bug.
> 
> The small app below crashes. All it does are some simple string
> maniuplations w/multithreading...
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10746
> 
> Øyvind
> 
> 
> public class Test
> {
>  static public String replaceAll(String in, String a,  String b)
>  {
>   String t="";
>   int i;
>   for (i=0; i<(in.length()-a.length()+1); i++)
>   {
>    String c=in.substring(i, i+a.length());
>    if (c.equals(a))
>    {
>     t+=b;
>     i=i+a.length()-1;
>    } else
>    {
>     t+=in.substring(i, i+1);
>    }
>   }
>   if (i<in.length())
>   {
>    t+=in.substring(i, in.length()-1);
>   }
>   return t;
>  }
>  
>  public static void main(String[] args)
>  {
>   Thread tr=new Thread(new Runnable()
>   {
>    public void run()
>    {
>     stressGB("second thread");
>    }
>   });
>   tr.start();
>   
>   stressGB("first thread");
>   
>   
>  }
>  static void stressGB(String thread)
>  {
>   char[] abs={'a','b','c','d'};
>   String foo="";
>   for (int i=0; i<100000000; i++)
>   {
>    if ((i%1000)==0)
>    {
>     System.out.println(thread + " " + i + " " + foo);
>    }
>    
>    double r;
>    r=Math.random();
>    
>    foo = foo + abs[(int)(((r * (abs.length-1))))];
>    r=Math.random();
>    
>    foo = replaceAll(foo, ""+abs[(int)(((r * (abs.length-1))))], "");
>   }
>  }
> }
> 
> 


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