Cuba application memory uses

I have one application deployed in jelastic environment. The initial ram was 1 gb but it was giving memory warnings, i increased it to 2gb. The memory uses warning reduced but they were still coming.

I increased the ram to 4gb but same thing is happening again. After 15 min use by single user, the system start consuming maximum memory and UI becomes slow and ultimately unresponsive.

My deployment environment is -

The ram consumption with times is -

Other resource are as

Is this normal for single user using the app?
Can you suggest remedial measures and point me to the tomcat settings i have to use (I have no knowledge of server but will read)?
What i can change in app or otherwise?

Any help is appreciated.



I monitored the app memory uses wrt different operation and found that this problem comes only when we are entering data for a particular entity - MasterLegalText. The entity definition is as follows, it is self referencing -

public class MasterLegalText extends StandardEntity {
    private static final long serialVersionUID = -3073148225651075805L;

    @Column(name = "TITLE", nullable = false)
    protected String title;

    @Column(name = "TYPE_", nullable = false)
    protected String type;

    @Column(name = "HTML")
    protected String html;

    @Lookup(type = LookupType.DROPDOWN, actions = "clear")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PARENT_ID")
    protected MasterLegalText parent;

    @Column(name = "POSITION_")
    protected Integer position;

    @Column(name = "IDENTITY_")
    protected String identity;

    @Lookup(type = LookupType.DROPDOWN, actions = {"lookup", "clear"})
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "REGULATION_ID")
    protected MasterRegulation regulation;

            joinColumns = @JoinColumn(name = "MASTER_LEGAL_TEXT_ID"),
            inverseJoinColumns = @JoinColumn(name = "MASTER_LEGAL_REGISTER_ID"))
    private List<MasterLegalRegister> masterLegalRegisters;

    public List<MasterLegalRegister> getMasterLegalRegisters() {
        return masterLegalRegisters;

    public void setMasterLegalRegisters(List<MasterLegalRegister> masterLegalRegisters) {
        this.masterLegalRegisters = masterLegalRegisters;

    public MasterRegulation getRegulation() {
        return regulation;

    public void setRegulation(MasterRegulation regulation) {
        this.regulation = regulation;

    public String getIdentity() {
        return identity;

    public void setIdentity(String identity) {
        this.identity = identity;

    public Integer getPosition() {
        return position;

    public void setPosition(Integer position) {
        this.position = position;

    public MasterLegalText getParent() {
        return parent;

    public void setParent(MasterLegalText parent) {
        this.parent = parent;

    public String getHtml() {
        return html;

    public void setHtml(String html) {
        this.html = html;

    public EnumLegalTextType getType() {
        return type == null ? null : EnumLegalTextType.fromId(type);

    public void setType(EnumLegalTextType type) {
        this.type = type == null ? null : type.getId();

    public String getTitle() {
        return title;

    public void setTitle(String title) {
        this.title = title;

Info about this entity and related screens-
There are more than 23000 data in it presently and edit screen is causing issue,
This edit screen is cuba auto-generated.
Browse screen modified to load data only related to one node.(@Loadbeforeshow removed). Same data as shown to user in seperate screen in readonly mode doesnot cause this issue. (for five concurrent users, the memeory uses remains 0.5gb)
We store html files in database for each record.

In edit screen parent lookup loads all 23000 records. Do this can cause this problem?


This error is displayed when UI become unresponsive.


The system hangs when iops uses increase abnormally.


Hi @umeshhodwala,

This is probably what triggers the problem. When you use a dropdown to select an entity, Cuba loads all possible records in memory. To confirm, change the dropdown to a picker field (remove or disable the collection loader from your screen).

After confirming this is the problem, you can check the view you are using in this collection loader and the MasterLegalText instance name pattern. Maybe your InstanceName (name pattern) needs to load the hierarchy to return the entity name. If that is the case, maybe you need to persist this value in the DB (and update it whenever the hierarchy changes) to prevent the need to load all the hierarchy all the time.


The problem was due to lookup only. I removed it and default create action. Now using create top and create child custom action using screen builder with parent entity supplied through .withinitilizer. It is working now.


1 Like

@knstvk is this thread still relevant? For long time i have problem with memory consuption. Lookup fields seems to be problem. Is there any workaround to be able to use lookup on large datasets (+50000 records)

it seems to me that application is using too much memory for lookups and that is the problem. Is it possible to adjust builtin filters so they do not save lookup results in memory but instead they request from database?

For large lists of options, use PickerField or SuggestionPickerField instead of lookup fields with drop-down lists. The former will be used in generic filter component automatically if you set an appropriate lookupScreenThreshold for the entity - see Entity Statistics.

1 Like