0 Replies Latest reply: Nov 22, 2010 9:27 AM by 817453 RSS

    Related to RealtimeThread creation and memory issue

    817453
      I wrote a sample program

      public static void main(String args[]) {

      try{

      System.out.println("Creating mainScopedMem scoped memory ");
      LTMemory mainScopedMem = new LTMemory(10240);

      System.out.println("Setup, in memory Area "+ RealtimeThread.getCurrentMemoryArea().size());

      new RealtimeThread( null, null, null, mainScopedMem, null,
      new Runnable () {
      public void run() {


      final ScopedMemory orderManagerScope = new LTMemory(240960);

      try{
      orderManagerScope.enter( new OrderManagerListener() );

      }catch( OutOfMemoryError err){
      System.out.println("OutOfMemoryError inner Runnable");
      err.printStackTrace();
      }
      }
      }).start();


      }catch( OutOfMemoryError err){

      System.out.println("OutOfMemoryError Outer Runnable");
      err.printStackTrace();

      }
      }

      and executed this code from netbeans, linux in virtual box

      -Xms512m -Xmx1024m -Xss1000 -XX:ThreadStackSize=0 -XX:ScopedSize=440960


      ulimit -s in linux gave me 10240



      I monitored memory via system monitor. I found that my memory started to grow from 786MB to 1.8G

      I tried creating a thread pool for 3000 Realtime thread.... My Single CPU got utilized 100% and its used 3.1GB for memory out of 3.3 and code started to hang..



      My question is. How much memory does a normal realtimeThread consumes... Is there any limit in creating Realtime thread... and Why does is consumes a lot of memory. If i need to do any fine tuning please do let me know.


      Hardware is not an issue in my case....

      Right now i am using viritual box. We are running our code in seperate RTLinux box.



      - Lemuria