I have a large delphi application and I am trying to keep the memory footprint low.
In my program I am using a component (Taco) and a component (TBurrito) that inherits from taco. Now just concerning the memory usage of the classes and not the actual instances, which scenario uses more memory?
A. Using just the TBurrito component everywhere
or
B. Using a combination of Taco and TBurrito components?
My one thought is that since TBurrito inherits Taco, the class Taco is already stored in memory and therefore using it will not increase the footprint of memory that much.
*Note - The component names are not really Taco and Burrito.
Every instance of Burrito
will occupy at least as much memory as an instance of Taco
. Subtract Taco.InstanceSize
from Burrito.InstanceSize
to find out how much more.
Using Burrito
exclusively will not save you any memory; the definition of Taco
will still exist, even if you have no instances of that exact class, because, at the very least, Burrito.ParentClass
still needs to refer to it.
Use the smallest component that achieves your needs, but unless Burrito
is huge compared to Taco
or you have a large number of Burrito
instances that could be Taco
instances instead, you're probably not going to see much overall effect on your memory usage. That will come from refraining from loading entire forms, or loading just pieces of a file instead of the whole thing.