Updated guest article (#2189)

* Create memory-leaks module

* Memory Leaks

* Added str.intern()

* Memory Leaks updated

* Updated guest article

* Memory Leaks update

* Remove unused resource

* Updated Memory Leaks Article
This commit is contained in:
maibin 2017-07-02 16:57:33 +02:00 committed by Eugen
parent 716e7c2123
commit 612b9a137d
1 changed files with 5 additions and 2 deletions

View File

@ -34,6 +34,7 @@
// for (int i = 0; i < 1000000; i++) { // for (int i = 0; i < 1000000; i++) {
// list.add(random.nextDouble()); // list.add(random.nextDouble());
// } // }
// System.gc();
// Thread.sleep(10000); //to allow GC do its job // Thread.sleep(10000); //to allow GC do its job
// } // }
// //
@ -54,11 +55,13 @@
// //
// @SuppressWarnings({ "resource" }) // @SuppressWarnings({ "resource" })
// @Test(expected = OutOfMemoryError.class) // @Test(expected = OutOfMemoryError.class)
// public void givenLengthString_whenIntern_thenOutOfMemory() throws IOException { // public void givenLengthString_whenIntern_thenOutOfMemory() throws IOException, InterruptedException {
// Thread.sleep(15000);
// String str = new Scanner(new File("src/test/resources/large.txt"), "UTF-8").useDelimiter("\\A") // String str = new Scanner(new File("src/test/resources/large.txt"), "UTF-8").useDelimiter("\\A")
// .next(); // .next();
// System.gc();
// str.intern(); // str.intern();
// System.out.println("Done"); // Thread.sleep(10000);
// } // }
// //
// @Test(expected = OutOfMemoryError.class) // @Test(expected = OutOfMemoryError.class)