B4J Question Gradual increase in RAM usage (up to 1GB)??


Active Member
Licensed User
I have this strange issue with B4J. Early on when I'm working with it, the RAM usage is around 160MB, which is totally fine. But gradually that amount increases. After a short while to 250, then 300, etc. When I come back to continue my work after several hours, the usage goes above 500, and it keeps increasing until once it even went beyond 1GB.
I don't mind the usage PER SE, because I have 8GB of RAM and there's plenty of free space. The only problem is that B4J gets reallly slow and annoying to work with. I have no choice then but to close and reopen B4J, which is not convenient. So it seems that it has to do with gradually piled up cache or garbage. Is there anyway to either prevent that or empty the cache without restarting?
Thanks a lot in advance.

(p.s. I did find one topic about this issue in the forums, but it was approached differently and I think this problem of mine needs a new thread. Still, I apologize if I should have added to that thread instead.)


B4X founder
Staff member
Licensed User
Longtime User
Still, I apologize if I should have added to that thread instead.
No need. You should always start a new thread.

This is not normal. I can keep B4J running here for weeks and the memory usage doesn't increase.

What happens if you leave it overnight? Does the memory usage continue to grow?
Upvote 0


Well-Known Member
Licensed User
Longtime User
maybe review your source code or simulate clicks, call subs with a timer for testing and see if the memory increase faster then.
u have used global variables / lists that memory objects?
what happens if u not work (or in front) at this app?
does it happens also with a newer android / java sdk?
which B4J version do you use?
Upvote 0


Active Member
Licensed User
Thanks guys.
I shall leave it running all night, without working with it, and see if the ram usage increases. I'll post the result.
I'm using B4J version 6.30
My app involves several separate code modules, each with its own layout, though I usually work only on one of them at a time. I don't open more than one B4J.
Variables are private unless they need to be accessed from another module (such as form ownership stuff).
It is basically a main screen with buttons, each of which opens one of the separate code modules and does something.
I'm using a local mysql database with WAMP. It doesn't involve a lot of tables. The queries are simple and fast.

UPDATE: I left B4j running all night, without working with it. There wasn't the slightest increase in RAM usage. It might have even dropped a little bit.
I'll try testing different things, and if I finally realize what the problem is, I'll post the solution.
Last edited:
Upvote 0