In this previous question I wondered how to decide size for objects. Now to another somewhat similar question. What if I have a solution to create objects in my own little memory play-area. What kind of object oriented design patterns do there exist to decide object size prior to construction?
The point would be two-fold:
- to try and make a single external allocation per construction, saving time and memory/pointer management overhead.
- by a single allocation we get locality in memory for each object which is nice for cache hitting purposes.
Is there some clever way to pair constructor argument list to for example static functions returning int? Maybe something factory-like?
Aucun commentaire:
Enregistrer un commentaire