Created
November 12, 2012 05:19
-
-
Save DiveInto/4057644 to your computer and use it in GitHub Desktop.
Revisions
-
DiveInto revised this gist
Nov 12, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public static void main(String[] args){ Thread thread = new Thread(){ public void run() { try { URLClassLoader cl = new URLClassLoader(new URL[]{new URL("file:/path-to/MLeaks/bin/")}); System.out.println(cl.toString()); Class<MLeaks> tmpClass = (Class<MLeaks>) cl.loadClass(MLeaks.class.getName()); -
DiveInto revised this gist
Nov 12, 2012 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; @@ -35,5 +34,4 @@ public void run() { thread.start(); } } } -
DiveInto created this gist
Nov 12, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ ```java import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; public class MLeaks { static byte[] m = new byte[1024 * 1024]; static ThreadLocal<MLeaks> tLocal = new ThreadLocal<MLeaks>(){ @Override protected MLeaks initialValue() { return new MLeaks(); } }; public static void main(String[] args){ while(true){ Thread thread = new Thread(){ public void run() { try { URLClassLoader cl = new URLClassLoader(new URL[]{new URL("file:/Users/mmliu/workspace/MLeaks/bin/")}); System.out.println(cl.toString()); Class<MLeaks> tmpClass = (Class<MLeaks>) cl.loadClass(MLeaks.class.getName()); tmpClass = null; } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }; thread.start(); } } } ```