N
none
Sorry if this is a FAQ, I searched and found nothing.
I have a rather large application that deals with lots and lots of this one
particular object type. The object is always a fixed size and contains no
pointers to external data (no heap allocations). It's basically just a
dumb block of memory, mabye 2 KB in size. In fact, it doesn't even have
any methods -- it's just a big block of state.
These objects are used ubiquitously throughout the application, and in
hundreds of functions, they are just declared right on the stack as local
variables.
I'm just wondering if this is inefficient. 2KB isn't huge by todays
standards, but it's large compared to an "int" or a "float." Should I be
using some sort of custom memory sub-allocator to deal with these, instead
of just declaring them as locals?
Thanks.
I have a rather large application that deals with lots and lots of this one
particular object type. The object is always a fixed size and contains no
pointers to external data (no heap allocations). It's basically just a
dumb block of memory, mabye 2 KB in size. In fact, it doesn't even have
any methods -- it's just a big block of state.
These objects are used ubiquitously throughout the application, and in
hundreds of functions, they are just declared right on the stack as local
variables.
I'm just wondering if this is inefficient. 2KB isn't huge by todays
standards, but it's large compared to an "int" or a "float." Should I be
using some sort of custom memory sub-allocator to deal with these, instead
of just declaring them as locals?
Thanks.