Sometimes, the Studio Memory Graph shows a lot of memory in use. The high memory usage may be caused by garbage built up in the JVM (java virtual machine's) heap memory.
It is not possible to force the JVM's GC (garbage collector) to run in order to remove the garbage. However, you can
request the JVM to run the GC by clicking the
Free Unused Memory button located under the Memory Graph. It is upto the JVM to decide whether to honor the request (and when).
In view of this, try clicking this button. If the Memory Graph drops as a result, it indicates that:
(1) High memory usage is due to garbage build-up.
(2) The JVM is responsive to a request to run the GC.
If the high memory usage is occurring frequently, and clicking the
Free Unused Memory button is effective in reducing memory usage each time, it is possible to automatically send a request to run the GC (instead of clicking the button each time) by creating a Procedure as below and using a Trigger to run the Procedure on a schedule.
-------------------
PROCEDURE p_Request_GarbageCollection()
BEGIN
declare input1 XML;
declare response XML;
declare temp XML;
set input1 = '<server:performServerAction xmlns:server="http://www.compositesw.com/services/system/admin/server"
xmlns:common="http://www.compositesw.com/services/system/util/common">
<server:actionName>FreeUnusedMemory</server:actionName>
</server:performServerAction>';
CALL /services/webservices/system/admin/server/operations/performServerAction(input1, response, temp );
CALL PRINT(CAST(response as VARCHAR));
CALL LOG('Freeing Unused Memory ...');
CALL LOG (CAST(response as VARCHAR));
END
-------------------
Each time the procedure is invoked, a line will be written to cs_server.log. For instance, if the Trigger is scheduled to run once a day, at 11:00, then the entries would look like this:
-------------------
INFO [WProcResult Invoker] 2020-03-07 11:00:00.410 -0800 LogProcedure - Freeing Unused Memory ...
INFO [WProcResult Invoker] 2020-03-08 11:00:00.919 -0800 LogProcedure - Freeing Unused Memory ...
INFO [WProcResult Invoker] 2020-03-09 11:00:00.653 -0800 LogProcedure - Freeing Unused Memory ...
-------------------