JoshyFun пишет:
The "problem" is that most objects are quite small, two pointers and
two int64 values (maybe 2 pointers more in a near future), but it must
be a class instead a record because it could be overriden and
specialized for other minor tasks (minor in the
amount of created objects). The big "but" is that the creation of this
objects will be in blocks of around 100 in average and every each
block some big objects are created and many times allocation pages
seens to be only half filled using the calculator and a rude
aproximation, so I'll try to put all the small objects in a single
block and see what happends with the memory (and also learn a bit more
about fpc ;) ).

I suppose you should really take a look at the GoF's flyweight design pattern. If I understood you right, it's exactly what you want. The trick is (in short): You create only a few objects which in turn don't store all information inside, but rather use an outer storage - so called context. In your case it can be an array of records with those pointers and Ints. When you intend to use a flyweight, you give it a pointer to a needed context (buffer cell). So maybe you can even create only 1 instance of a needed class. The buffer of contexts can be easily allocated without fragmentation (use array or vector).
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to