B4J Question About debugging and threads memory management

Discussion in 'B4J Questions' started by vfafou, Apr 30, 2015.

  1. vfafou

    vfafou Active Member Licensed User

    Hello!
    Is there any way to detect memory leaks?
    How can I force release - dispose - destroy of a thread?
    Is it possible runtime errors to leave bad data in memory?
    Could Try-Catch-End Try block help to avoid such situations?
    Thank you in advance!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Did you encounter an out of memory error?
     
  3. vfafou

    vfafou Active Member Licensed User

    No, but when custom Web socket framework is working some hours, it causes sudden client disconnections, uses more memory with the same number of clients and finally is getting heavy loaded and unresponsive. Somewhere in the code I have added, I might have caused a memory leak, but I can't detect where it is.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You can use a tool such as VisualVm to find memory leaks: https://visualvm.java.net/

    Memory leaks should eventually lead to an out of memory error.
     
    vfafou likes this.
  5. vfafou

    vfafou Active Member Licensed User

    Hi!
    I've found that setMaxIdleTime value of database connection pool, was accidentally set at 0. I've set it at 1200 and I've given setUnreturnedConnectionTimeout a value of 120 seconds. The server is up and running for 38 hours without any problem.
    The only thing I've noticed, is that JVM creates many threads (~430) where most of them are totally unused! Is it a normal state?

    BTW, I tried B4J beta! All I've done by now, seems stable. The most amazing I've used is the Dark Theme! It's my favorite generally to all IDE's I use!
    @Erel: Keep up the amazing work! Congrats!!!:):):)
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    It depends on your app. Each AsyncStreams object uses two threads.

    The JVM is capable of handling hundreds of threads.
     
  7. vfafou

    vfafou Active Member Licensed User

    Thank you Erel! This Application does not use Asyncstreams.
    Is the following state reasonable, with ~150 concurrent devices? The memory use has been gradually increased, starting from ~95MB three days ago. Will this state drive to an out of memory error? By the way, I just saw the following warning:
    org.eclipse.jetty.websocket.api.ProtocolException: Client MUST mask all frames (RFC-6455: Section 5.1)
    What does it mean?
    Screen Shot 2015-05-03 at 09.24.37.png
     
    Last edited: May 3, 2015
  8. Erel

    Erel Administrator Staff Member Licensed User

    The memory usage is expected to increase until a certain limit. As long as it maintains a steady state then the memory usage is fine.

    I'm not sure what it means, however over time you will see many communication errors due to disconnections in all kind of states.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice