Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
The web browser javascript heap memory size in a Lowcoder app keeps growing indefinitely as previously allocated objects are not released by the Javascript code. This can be observed by opening Window > Task Manager (google chrome) and enabling the JavaScript Memory column (right click on the column labels row to configure which columns are visible).
Expected Behavior
The user keeps interacting with the app, opening and closing drawers/modals for selected table elements. The javascript heap memory size should more or less remain the same throughout time upon a garbage collection and should not increase linearly (or exponentionally).
Steps to reproduce
This can be easily reproduced with the following steps.
- Create a new App
- Add a new drawer (drawer1) to the App
- Add multiple text input fields to the drawer (e.g. 12 text input fieds)
- Add new button to the App (not inside the drawer), with the label "Memory Leak Test"
- Add a new event to the button that onClick executes the following javascript code:
`function delay(time) {
return new Promise(resolve => setTimeout(resolve, time));
}
function openDrawer() {
drawer1.openDrawer();
}
function closeDrawer() {
drawer1.closeDrawer();
}
async function memoryLeakLoop() {
for(let i=1;i<=500;i++) {
setTimeout(openDrawer, 10);
setTimeout(closeDrawer, 100);
await delay(200);
}
}
memoryLeakLoop();`
- Now preview the app. Make sure to copy paste the app preview url.
- Close all Lowcoder tabs and paste the previously copied url to preview the new App
- Now after the app loads open the chrome Task Manager.
- Wait that the Javascript Memory field decreases and stops changing (or changing very little, meaning all initial app load resources have been released upon garbage collection)
- Now press the "Memory Leak Test" button and wait that the drawer stops opening and closing.
- Wait until the Javascript Memory decreases and stops changing again.
- Now compare the Java heap size with the initial one and notice that the value is much higher (e.g. additional ~25MB that have not been released)
Environment
This was tested on https://app.lowcoder.cloud/ using google chrome, but the same happens in other browsers.
Additional Information
The problem gets worse when for example you have an app that displays a table. Upon clicking of a table row a "queryDetails" is called to retrieve the full information about that table row. A success even handler on queryDetails then opens up a drawer to show the full information of the table row, retrieved with the new query. As the user keeps clicking different rows of the table, Lowcoder doesn't release the memory used by previous executions queryDetails and the pace of increasing of the heap memory size is even worse.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status