*

sors

  • *
  • 13
    • View Profile
High memory consumption
« on: 09 September 2018, 17:55:03 »
Hi, I keep my gui in a txt file.
Load my gui:
Code: [Select]
tgui::Gui gui;
gui.loadWidgetsFromFile("MyTxtFile.txt")
my "MyTxtFile.txt":
Code: [Select]
///Top Panel
Panel."TopLeftPanel" {
    Position = (0, 0);
    Size = (385, 80);
    Visible = true;

    Renderer {
        BackgroundColor = Transparent;
    }

    Picture {
//Size = (500, 500);
Renderer {
texture = "data/gui/tiles/panels/LeftTopPanel.png";
transparenttexture = false;
}
    }
}

Panel."TopPanel" {
    Position = ("parent.width * 0.5 - 125", "0");
    Size = (270, 140);
    Visible = true;

    Renderer {
        BackgroundColor = Transparent;
    }

    Picture {
//Size = (500, 500);
Renderer {
texture = "data/gui/tiles/panels/TopPanel.png";
transparenttexture = false;
}
    }

    Label."Time" {
        AutoSize = true;
        Position = ("parent.width * 0.5 - 25", 10);
Text = "11:23";
        TextSize = 23;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Label."Date" {
        AutoSize = true;
        Position = ("parent.width * 0.5 - 35", 35);
Text = "01.01.1950";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Label."GameSpeed" {
        AutoSize = true;
        Position = ("parent.width * 0.5 - 5", 55);
Text = "1x";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}
}

///MiniMap
Panel."MiniMap" {
    Position = ("parent.width - 300", "0");
    Size = (300, 300);
    Visible = true;

    Renderer {
        BackgroundColor = Transparent;
    }

    Picture {
//Size = (500, 500);
Renderer {
texture = "data/gui/tiles/panels/MiniMap.png";
transparenttexture = false;
}
    }

Canvas."MiniMapCanvas" {
Position = (44, 9);
Size = (250, 250);
}
}

Button."Bastion" {
    Position = (16, parent.height - 80);
    Size = (64, 64);
    Text = "";
    TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/ui.png" Part(0, 192, 64, 64);
texturedown = "data/gui/tiles/ui.png" Part(0, 256, 64, 64);
texturefocused =  "data/gui/tiles/ui.png" Part(0, 192, 64, 64);
texturehover = "data/gui/tiles/ui.png" Part(0, 320, 64, 64);
}
}

Button."Manager" {
    Position = (96, parent.height - 80);
    Size = (64, 64);
    Text = "";
    TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/ui.png" Part(64, 192, 64, 64);
texturedown = "data/gui/tiles/ui.png" Part(64, 256, 64, 64);
texturefocused =  "data/gui/tiles/ui.png" Part(64, 192, 64, 64);
texturehover = "data/gui/tiles/ui.png" Part(64, 320, 64, 64);
}
}

Button."Walls" {
    Position = (176, parent.height - 80);
    Size = (64, 64);
    Text = "";
    TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/ui.png" Part(128, 192, 64, 64);
texturedown = "data/gui/tiles/ui.png" Part(128, 256, 64, 64);
texturefocused =  "data/gui/tiles/ui.png" Part(128, 192, 64, 64);
texturehover = "data/gui/tiles/ui.png" Part(128, 320, 64, 64);
}
}

Button."Floor" {
    Position = (256, parent.height - 80);
    Size = (64, 64);
    Text = "";
    TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/ui.png" Part(192, 192, 64, 64);
texturedown = "data/gui/tiles/ui.png" Part(192, 256, 64, 64);
texturefocused =  "data/gui/tiles/ui.png" Part(192, 192, 64, 64);
texturehover = "data/gui/tiles/ui.png" Part(192, 320, 64, 64);
}
}

Button."Objects" {
    Position = (336, parent.height - 80);
    Size = (64, 64);
    Text = "";
    TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/ui.png" Part(256, 192, 64, 64);
texturedown = "data/gui/tiles/ui.png" Part(256, 256, 64, 64);
texturefocused =  "data/gui/tiles/ui.png" Part(256, 192, 64, 64);
texturehover = "data/gui/tiles/ui.png" Part(256, 320, 64, 64);
}
}

Button."Zones" {
    Position = (416, parent.height - 80);
    Size = (64, 64);
    Text = "";
    TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/ui.png" Part(320, 192, 64, 64);
texturedown = "data/gui/tiles/ui.png" Part(320, 256, 64, 64);
texturefocused =  "data/gui/tiles/ui.png" Part(320, 192, 64, 64);
texturehover = "data/gui/tiles/ui.png" Part(320, 320, 64, 64);
}
}

///ZonesPanel
ScrollablePanel."ZonesPanel" {
    ContentSize = (0, 0);
    Position = (0, parent.height - 528);
    Size = (280, 448);
Visible = false;

    Renderer {
        BackgroundColor = Transparent;
scrollbar {
texturearrowup = "data/gui/tiles/panels/ZonesPanel.png" Part(300, 0, 20, 20);
texturearrowuphover = "data/gui/tiles/panels/ZonesPanel.png" Part(320, 0, 20, 20);

texturearrowdown = "data/gui/tiles/panels/ZonesPanel.png" Part(300, 468, 20, 20);
texturearrowdownhover = "data/gui/tiles/panels/ZonesPanel.png" Part(320, 468, 20, 20);

texturethumb = "data/gui/tiles/panels/ZonesPanel.png" Part(340, 0, 20, 60) Middle(0, 20, 20, 20);
texturethumbhover = "data/gui/tiles/panels/ZonesPanel.png" Part(360, 0, 20, 60) Middle(0, 20, 20, 20);

texturetrack = "data/gui/tiles/panels/ZonesPanel.png" Part(300, 20, 20, 448);
texturetrackhover = "data/gui/tiles/panels/ZonesPanel.png" Part(320, 20, 20, 448);
}
    }

    Picture {
//Size = (500, 500);
Renderer {
texture = "data/gui/tiles/panels/ZonesPanel.png" Part(0, 0, 280, 800);
transparenttexture = false;
}
    }

    Button."Delete" {
        Position = (0, 0);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 0, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 64, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(384, 0, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 128, 64, 64);
}
    }

    Label."WarehouseGroup" {
        AutoSize = true;
        Position = (16, 80);
Text = "WarehouseGroup";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Button."Dump" {
        Position = (0, 96);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 192, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 256, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(384, 192, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 320, 64, 64);
}

    }

    Button."Warehouse" {
        Position = (64, 96);
        Size = (64, 64);
        Text = "";
        TextSize = 20;
   
Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 192, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 256, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(448, 192, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 320, 64, 64);
}
    }

    Button."Barn" {
        Position = (128, 96);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 192, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 256, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(512, 192, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 320, 64, 64);
}

    }

    Button."Armory" {
        Position = (192, 96);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(576, 192, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(576, 256, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(576, 192, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(576, 320, 64, 64);
}
   
    }

    Label."MiningGroup" {
        AutoSize = true;
        Position = (16, 176);
Text = "MiningGroup";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Button."Forestry" {
        Position = (0, 192);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 384, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 448, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(384, 384, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 512, 64, 64);
}

    }

    Button."Quarry" {
        Position = (64, 192);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 384, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 448, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(448, 384, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 512, 64, 64);
}

    }

    Button."Energy" {
        Position = (128, 192);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 384, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 448, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(512, 384, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 512, 64, 64);
}
   
    }

    Button."Engineering" {
        Position = (192, 192);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(576, 384, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(576, 448, 64, 64);
texturefocused =  "data/gui/tiles/panels/ZonesPanel.png" Part(576, 384, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(576, 512, 64, 64);
}
   
    }

    Button."MeatFarm" {
        Position = (0, 256);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 576, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 640, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 576, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 704, 64, 64);
}

    }

    Button."VegetableFarm" {
        Position = (64, 256);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 576, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 640, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 576, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(448, 704, 64, 64);
}
   
    }

    Button."FruitFarm" {
        Position = (128, 256);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 576, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 640, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 576, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(512, 704, 64, 64);
}

    }

    Label."MilitaryGroup" {
        AutoSize = true;
        Position = (16, 336);
Text = "MilitaryGroup";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Button."Barracks" {
        Position = (0, 352);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 768, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 832, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 768, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 896, 64, 64);
}
   
    }

    Label."RecreationGroup" {
        AutoSize = true;
        Position = (16, 432);
Text = "RecreationGroup";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Button."Bedroom" {
        Position = (0, 448);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 960, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1024, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 960, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1088, 64, 64);
}

    }

    Label."HospitalGroup" {
        AutoSize = true;
        Position = (16, 528);
Text = "HospitalGroup";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Button."Hospital" {
        Position = (0, 544);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1152, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1216, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1152, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1280, 64, 64);
}

    }

    Label."MarketGroup" {
        AutoSize = true;
        Position = (16, 624);
Text = "MarketGroup";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Button."Market" {
        Position = (0, 640);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1344, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1408, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1344, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1472, 64, 64);
}

    }

    Label."CanteenGroup" {
        AutoSize = true;
        Position = (16, 720);
Text = "MarketGroup";
        TextSize = 15;
   
        Renderer {
            BackgroundColor = Transparent;
            BorderColor = Black;
            Borders = (0, 0, 0, 0);
            Padding = (0, 0, 0, 0);
            TextColor = #BEBEBE;
        }
}

    Button."Canteen" {
        Position = (0, 736);
        Size = (64, 64);
        Text = "";
        TextSize = 20;

Renderer {
textcolor = rgb(190, 190, 190);
textcolorhover = rgb(250, 250, 250);

texture = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1536, 64, 64);
texturedown = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1600, 64, 64);
texturefocused = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1536, 64, 64);
texturehover = "data/gui/tiles/panels/ZonesPanel.png" Part(384, 1664, 64, 64);
}
   
    }
}
when rendering the interface is spent approximately 1 GB ?

I noticed that if I delete
Code: [Select]
ScrollablePanel."ZonesPanel"in "MyTxtFile.txt" then the memory is consumed much less, why so ?

*

texus

  • *****
  • 1279
    • View Profile
    • Texus's Blog
Re: High memory consumption
« Reply #1 on: 09 September 2018, 18:05:14 »
Could you send me your data/gui folder so that I can test loading the file here?
Also, how are you checking the memory exactly? Did you check if the memory drops again after calling gui.removeAllWidgets() (e.g. do this on a keypress).
« Last Edit: 09 September 2018, 18:07:14 by texus »

*

sors

  • *
  • 13
    • View Profile
Re: High memory consumption
« Reply #2 on: 09 September 2018, 18:31:14 »
Strangely enough, but now everything is in order, I rebuilt the project on another PC, and now everything is fine.
I'll try a couple more tests, and if this situation repeats, I'll send you my data/gui and txt file