Memory usage
Posted: Sat Mar 03, 2007 14:09
I found some frequently used widgets are realized not cheap, such as StaticText. It owns two scrollbars, a scrollbar owns three PushButtons.
The following table shows the memory grows up during a StaticText creating: (Unit:KB)
So you can see the ScrollBars cost 712KB. Most time we only need a simple text widget, like a Caption(with Font and Color properties), we need not the ScrollBars.
And for a Game GUI, there will be likely up to 100 Caption widgets(without scrollbars) needed, if we use the current StaticText, we wasted 712KB*100 = 71.2MB memory.
So I strongly suggest it is better to add a cheap Caption widget. And for other widget realization, it is also better when the realization is cheep.
Regards,
zhk_tiger
The following table shows the memory grows up during a StaticText creating: (Unit:KB)
Code: Select all
Mem Usage VM Size Total Cost
18772 14828 33600
StaticText
self created 18812 14868 33680 80
Children ScrollBars
created 19168 15224 34392 712
So you can see the ScrollBars cost 712KB. Most time we only need a simple text widget, like a Caption(with Font and Color properties), we need not the ScrollBars.
And for a Game GUI, there will be likely up to 100 Caption widgets(without scrollbars) needed, if we use the current StaticText, we wasted 712KB*100 = 71.2MB memory.
So I strongly suggest it is better to add a cheap Caption widget. And for other widget realization, it is also better when the realization is cheep.
Regards,
zhk_tiger