2 Replies Latest reply on Feb 2, 2012 5:04 PM by user594312

    Mission Control: Trying to find my class in Memleak in Reference Type


      I'm trying to create some demonstrations of Mission Control and I want to create an example where I have a memory leak and I want to get to my class using reference type.

      This is my code:

      public class ThunderBombCracker {
      public ThunderBombCracker() {

      public void boom() {
      for (int index = 0; index < 10; index++) {
      new Thread("ThunderBombCracker " + index) {
      public void run() {
      List<ClientTo> lista = new ArrayList<ClientTo>();

      try {
      Random random = new Random();

      for (int index1 = 0; index1 < 120000; index1++) {
      byte[] buffer = new byte[16];

      for (int index2 = 0; index2 < 16; index2++) {
      buffer[index2] = (byte) (65 + random.nextInt(32));

      lista.add(new ClienteTo(new String(buffer)));



      } catch (Throwable e) {

      public static void main(String[] args) {
      ThunderBombCracker boom = new ThunderBombCracker();


      Basically I create a lot of 16 character Strings and pass them to my own class ClientTo and wait for 1 minute. Now, when I run memleak I can see a lot of char[], a lot of Strings, a lot of ClientTo. But if I try to check the reference types of String it won't show ClientTo. Maybe I'm missing something here about how JRockit or Memleak works.


      Néstor Boscán