i was wondering if anyone knew how much RAM c++ builder's components use. like for example if i was to add a TStaticText to my project, how much extra memory would be needed. also does anyone know much memory a TCustomControl
takes up?
Well, just a reminder : simple sizeof(xxx) is not going to be enough for every component! Some of them act as containers which means that there is a lot more of data allocated in memory then sizeof() can tell...
But as you can see a Form is a container too, but it has a class and this class (TForm) has the all size for the unit (Window). So if you want to know the size of your unit (Window, Form) you just call the sizeof method like this
Also remember that some containers contain pointers. A pointer says nothing about the size of the data it's pointing to. For instance, the following object would seem simple:
struct MyStruct
{
char x;
TList *List;
}mystruct;
It's size will only be...3 bytes I believe? I don't know how many bytes it takes to store a TList pointer, but it's small, you get the idea. The problem is that TList might contain a list of 1000000 strings or other objects.
Just out of curiousity, do you mind saying why you are concerned with memory on those components? They seem very insignificant for a windows program. I wouldn't think even the minimum PC with requirements for Win95 would have any problems with adding one of those.
Yes, Supernat03, that's exactly what what I meant to say with "containers" - you can never know (without looking at source code) how contained objects are stored inside contatiner! It is allways some kind of TList, or something similar, which is a small class, but dynamically allocates memory as the members are added.
And, TList* occupies 4 bytes (at least till we all have Opterons and 64-bit Windows
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.