• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Java memory usage

    Scripting general Discussion
    2
    5
    2.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      C00L3R
      last edited by

      Hello,
      I wanted to use script to increase memory space for Java to use.

      I've copied "memory-small.sh" script from "ext-available" to "ext-enabled" folder. And unfortunally nothing happens. In internal metrics there's still "JVM maximum available memory (MB) - 622Mb" and nothing changes.

      Mango version is licensed 2.8.8.

      Greetings

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by phildunlap

        Hi C00L3R,

        Might it be possible you are restarting the instance from within Mango? That script only modifies the JAVA_OPTS in the "init" portion of the script lifecycle, such that it doesn't repeatedly modify them at restart. So, you would need to stop Mango completely, then start it again to pick up things in "init" blocks in the ext scripts.

        You should be able to see that the modified JAVA_OPTS have taken effect by doing a ps $(pidof java) at the command line once its running, which will show the memory settings in the description of the process / arguments.

        Alternatively, might you be on Windows and need to use the .bat file?

        1 Reply Last reply Reply Quote 0
        • C
          C00L3R
          last edited by C00L3R

          Yes, Mango is running od Windows system.
          So I tried with putting a .bat file in "ext-enabled" folder.

          memory-small.bat

          if "%1" == "init" (
                  rem Startup with Java Memory setup for small installation
                  set JAVAOPTS=%JAVAOPTS% -Xms2500m -Xmx3200m
          )
          

          It still doesn't work. But when I tried .bat file on my test Mango installation with core 3.2.1 it worked perfectly.

          //Edit

          Hm, in Mango 3,2,1 on Windows max memory space limit comes from .sh file. I tried deleting .bat file and nothing changes. When I changed limits in .sh file to 1600M, I see in task manager the Java is taking that 1600M.

          1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by phildunlap

            The scripts in Mango/bin haven't changed in the 3.3 series (and the changes since 3.2.1 haven't had anything to do with extension scripts), and minimal changes for quite some time prior. My test is once with both a .bat and a .sh memory file in ext-enabled, with the bat setting memory to 1600 and the sh setting it to 1500, then again with only the sh file in ext-enabled.

            With both,
            0_1521127170314_mistakenBat.png

            With only sh
            0_1521127193661_mistakenBat2.png

            So I believe you are mistaken. You need to completely stop Mango, then start it again, to have the ext scripts called with the 'init' first argument.

            1 Reply Last reply Reply Quote 0
            • C
              C00L3R
              last edited by

              Yes I tried to stop and start Mango again but it didn't help at all.

              Finally I resolved it by editing script in ma-start.bat -

              "%EXECJAVA%" %JPDA% %JAVAOPTS% -server -Xmx2500m -Xms1000m -Dma.home="%MA_HOME%" -cp "%MA_CP%" com.serotonin.m2m2.Main
              

              Maybe it's not elegant but now I see change in memory usage after starting Mango.

              Thanks for help.
              Greetings

              1 Reply Last reply Reply Quote 0
              • First post
                Last post