Changeset 502

Show
Ignore:
Timestamp:
05/30/08 15:22:21 (7 months ago)
Author:
chris
Message:

Remove the reference from NativeLibrary? to its ClassLoader?, it was
preventing the whole thing from getting GC'd.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Mika/trunk/core-vm/java/java/lang/Runtime.java

    r454 r502  
    22* Parts copyright (c) 2001, 2002, 2003 by Punch Telematix. All rights     * 
    33* reserved.                                                               * 
    4 * Parts copyright (c) 2004, 2005, 2007 by Chris Gray, /k/ Embedded Java   * 
    5 * Solutions. All rights reserved.                                         * 
     4* Parts copyright (c) 2004, 2005, 2007, 2008 by Chris Gray, /k/ Embedded  * 
     5* Java Solutions. All rights reserved.                                    * 
    66*                                                                         * 
    77* Redistribution and use in source and binary forms, with or without      * 
     
    475475      } 
    476476      else { 
    477         throw new UnsatisfiedLinkError("Library '" + libname + "' already loaded"); 
     477        // HACK HACK HACK 
     478        // Maybe the existing library is unreachable but we didn't notice, 
     479        // do GC and try once more before throwing an error. 
     480        gc(); 
     481        doLoadedLibrariesHousekeeping(); 
     482        if (loadedLibraries.get(libname) == null) { 
     483          loadedLibraries.put(libname, "loading"); 
     484        } 
     485        else { 
     486          throw new UnsatisfiedLinkError("Library '" + libname + "' already loaded"); 
     487        } 
    478488      } 
    479489    } 
     
    518528 
    519529    if (handle != 0) { 
    520       NativeLibrary nl = new NativeLibrary(handle, cl); 
     530      NativeLibrary nl = new NativeLibrary(handle); 
    521531      cl.registerLibrary(nl); 
    522532     
  • Mika/trunk/core-vm/java/wonka/vm/NativeLibrary.java

    r451 r502  
    11/************************************************************************** 
    2 * Copyright (c) 2007 by Chris Gray, /k/ Embedded Java Solutions.          * 
     2* Copyright (c) 2007, 2008 by Chris Gray, /k/ Embedded Java Solutions.    * 
    33* All rights reserved.                                                    * 
    44*                                                                         * 
     
    4040  private int handle; 
    4141 
    42   private ClassLoader loader; 
    43  
    44   public NativeLibrary(int handle, ClassLoader loader) { 
     42  public NativeLibrary(int handle) { 
    4543    this.handle = handle; 
    46     this.loader = loader; 
    4744  } 
    4845