B4J Question Class takes up ram?

le_toubib

Active Member
Licensed User
Longtime User
I have a class that returns a pane filled with labels of person's data.
Labels are created programmatically within the class.
In a loop of minimum 5, I call this class with a map of person data. And then put it in a list view.
Each loop is called by user, and After each loop I clear items of the listview, to fill it with the next group of persons
Everything was working fine, even with very large loops 200+ instances.

Untill I decided to "tidy things up" by loading a designer layout into the pane, containg same labels. No difference, same code.

Then the whole app started to hang, producing java.exe error, after only 3-4 loops, 5 iterations each... This is improved a little bit when using another device with 8gb ram rather than 4gb
..
Question 1 : what went wrong? Does it mean that layout consumes more ram?

Question 2 : is there a way to clear ram from class data after every loop.
 

le_toubib

Active Member
Licensed User
Longtime User
Are you testing it in release mode? Where is the error message?

I would have used xCustomListView with lazy loading. This way you only add a few items and either add more when needed, or more efficiently, reuse the layouts.
It only happens in release mode, on clients computers,
It happens when loading only 5 iterations, which is the usual case, so there s no actual need for lazy-load.
It never happened on my design computer, it happens 3-5 per hour on client computers, so I can't get an error message.
Only Windows event loggers java.exe error.
I'll look for xCustomListView.. But, is there a way to clear ram after class usage?
Java 8.0.74
B4j 7.31
8gb ram
Core i7
 
Upvote 0

le_toubib

Active Member
Licensed User
Longtime User
There is no such thing. Classes by themselves do not consume memory.

You need to run it from the command line (java -jar or debug_run.bat) to be able to see the error message.
i'm starting to learn with xcustomlistview , does it actually use less resources than loading panes inside a listview ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…