2 Replies Latest reply on Jul 9, 2010 2:44 AM by 807557

    About Scoped Memory Size

      I am using JRTS newly. I have a question. I have wrote a simple code about scoped memory size. It is below
      import javax.realtime.LTMemory;
      import javax.realtime.RealtimeThread;
      import javax.realtime.ScopedMemory;
      public class Test extends RealtimeThread{
            * @param args
           public void run(){
                final ScopedMemory outerScoped = new LTMemory(1000);
                System.out.println("outerScoped.memoryConsumed() "+outerScoped.memoryConsumed());
                System.out.println("outerScoped.memoryRemaining() "+outerScoped.memoryRemaining());
                System.out.println("outerScoped.getMaximumSize() "+outerScoped.getMaximumSize());
           public static void main(String[] args) {
                Test test = new Test();
                try {
                } catch (InterruptedException e) {
                     // TODO Auto-generated catch block
      Output is
      outerScoped.memoryConsumed() 0
      outerScoped.memoryRemaining() 16384
      outerScoped.getMaximumSize() 1000
      Consumed is 0(normal)
      Max is 1000 normal
      But Remaining 16384 why? I have setted 1000 byte. Why does remaining 16384. It must be 1000

      Best Regards,
        • 1. Re: About Scoped Memory Size

          Please have a look at the scoped memory related section in the technical information document:

          For your specific question, search for ScopedMemoryAllocGrain.


          • 2. Re: About Scoped Memory Size
            There is a bug here as well: getMaximumSize() should return the actual maximum as size() returns the actual size, not the value passed to the constructor. It should always be the case that size() <= getMaximumSize()

            David Holmes