B4J Question Class takes up ram?

Discussion in 'B4J Questions' started by le_toubib, May 12, 2019.

  1. le_toubib

    le_toubib Active Member Licensed 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.
     
  2. Erel

    Erel Administrator Staff Member Licensed 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.
     
  3. le_toubib

    le_toubib Active Member Licensed User

    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
     
  4. Erel

    Erel Administrator Staff Member Licensed 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.
     
  5. le_toubib

    le_toubib Active Member Licensed User

    i'm starting to learn with xcustomlistview , does it actually use less resources than loading panes inside a listview ?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    No. However the panes in the listview are not the cause of any memory problem you have unless you are adding 100k+ items. First step is to post the error message.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice