java using 200 MB of memory with only tws

Discussion in 'Trading Software' started by Cdntrader, Aug 16, 2006.

  1. Look. TWS is shit. Don't listen to any of the monkeys who run around here and defend IB any time there's a problem. I recommend that you switch immediately.
     
    #21     Aug 17, 2006
  2. Stock, Cdn,

    Try doing what I do. Observe memory use to see how it affects your machine.

    I normally run TWS minimized with Sierrachart and ZLT accessing it. It will grow hugely if I let it.

    To prevent it I restore it (to show it), wait a couple of seconds, and minimize it. This process seems to force a clean up.


    It then starts to grow back but takes a while (not as long as older versions used to do). Note that backfill will blow it out quickly.

    I have a macro that does this to SC and ZLT at the same time and hit it every half an hour or so to keep my pc running cleanly. SC is tidy but ZLT like TWS becomes a resource hog if you give it a chance.
     
    #22     Aug 17, 2006

  3. i dont listen to anybody who shills...but am curious about what alternatives u have in mind; same commish, same range of products.

    tia
     
    #23     Aug 17, 2006
  4. For anybody that wants to get a better understanding of memory utilization with TWS (or any Java application) and is prepared to spend a (very) little effort, I recommend that you download the jdk (java software development kit) from Sun.

    A tool called jconsole is included with the 1.5 jdk. It can be used to monitor memory heap allocation. To use it, add the option:

    Code:
    -Dcom.sun.management.jmxremote
    
    to the command line that runs TWS. Then(re)start TWS.

    Start the jconsole tool, and click on the memory tab. You will see a dynamically updated chart of the memory heap size. Click on the 'Perform GC' button and observe the results. (GC is Garbage Collection).

    Use google to learn more. Hint - a full GC is performed with MarkSweepCompact. 2nd hint - just because the heap is growing doesn't mean there is a memory leak or 'lazy programmers'; it relates to the maximum heap size specified with -Xmx command line swith.
     
    #24     Aug 17, 2006
  5. I was trying not to become a Java guru over this.

    I don't understand why backfill would be making TWS eat up memory. That is a dynamic process that should require a small amount of memory when called, then released. TWS is not storing the backfill data, or at least should not be.

    If the memory usage is growing from <100meg to 250 meg, with no charts or other additional modules being invoked , this is a BUG in the memory handling.

    I could live with it except it eventually kills TWS and it has to be closed (will not close cleanly, has to be killed).
     
    #25     Aug 17, 2006
  6. hmm I do use QT w/ the ib feed so perhaps this is what is happening.

    The backfill data through the day is using more java resources?

    The only solution is a new box with 2-4GB memory I guess.
     
    #26     Aug 17, 2006
  7. Stock777,

    While I don't know the exact circumstances of the problems you are having, you need to understand a little of whats happening here.

    When the Java application is finished with something like the memory used for backfill, it releases it back to the java heap and not necessarily back to the operating system. Over time the heap becomes fragmented, so although there is enough memory, it will be a in small bits. Java may not be able to find a big enough bit to create a new object. At this point it will grow the heap by requesting more memory from the operating system. It will continue to grow the heap until it approaches the limit set on the command line. At this point it will compact the heap, and release memory back to the operating system if possible.

    Of course, it is always possible that there is a memory leak in TWS, but I think it more likely the case that it is just the way Java works.

    I know that this does not solve your problem, but I always think it pays to get an insight into issues.
     
    #27     Aug 17, 2006
  8. Does all this talk about memory handling have anything to do with tws quotes lagging after a time? Whenever tws is open for 3-4 hours, the quotes start to get clogged, and I need to shutdown and re-open. How do I start to look into this problem?
     
    #28     Aug 17, 2006
  9. dst

    dst Interactive Brokers

    To stock777 and Cdntrader - would you please PM me your usage pattern and I'll investigate your problems. What you are experiencing seems to be very abnormal. Thank you.
     
    #29     Aug 17, 2006
  10. Stock777

    I noticed your comment about having to kill TWS.

    I am running on Linux, so milage may be different, but I have had to kill TWS on a couple of occasions when I have had lots of things running and the machine is low on memory and is swapping heavily. There are messages about thread deadlock in the TWS log.

    This strikes me as possibly a bug. It might be worth reporting to IB.

    The immediate solution though, is to get more memory.
     
    #30     Aug 17, 2006