B4J Question WEBSocket Server Memory usage

Swissmade

Well-Known Member
Licensed User
Longtime User
Hi all,

I have a small Websocket Server where about 8 connections at the same time are made.
To be sure that th web-page is updated all the time I have a refresh time of the web page set to 10 minutes. The Web-page disconnects and connects again after this time has reach.

Now the problem.
The Server start with a Memory usage from about 30mb and threads usage 27.
Startup the server with this code below.
B4X:
#VirtualMachineArgs: -Xms128m -Xmx128m

After a while the server reach more then this 128mb and I get a out of memory error.
Threats are also go high to 400-500 threads
So I have the idea that there still old unused connections busy with something.
How can I delete this unused connections and free up my resources.

Many thanks for help
 

Swissmade

Well-Known Member
Licensed User
Longtime User
you have created a leak somewhere
I think I have found whats the problem.
In the Module I had a timer and have not stop this when the socket is disconnected.
The Timer is needed to update the time on the Web-page and to test some setting.
If settings are changing the Web-page get updated.
Every 1000ms.
It seems, that this is still running in the Background.

Is there an other way to run a timer in the WSmodule part without this problem??

Now I have disable the Timer the Server is running well for the last hours.
Memory about 35 mb and threads about 35-40.

If you still like I can send the Project.
 
Upvote 0
Top