vfunc@talktalk.net wrote:[color=blue]
> Instances possibly but otherwise no, that is not what I am asking.
> Restrict the allocation to a specific size be that in one class or for
> all instances of a particular class within a module (not globally)
> e.g. say I want a class to use no more than 1Mb of memory.[/color]
I guess I don't understand the problem yet. If you need to restrict
the amount of memory spent on any particular class, including any
dynamic memory objects allocate, you'll need to have some kind of
measurement built into every object. That measurement would account
for the dynamic memory as well as the memory the object itself takes
(sizeof(object)). You're going to need some overhead accounting as
well, but that's implementation-specific.
Now, if you do not care to account for the dynamic memory the objects
themselves can allocate, then you just count instances because the
memory they occupy will be (N * sizeof(thatclass)). IOW, take your
1 Mb and divide it by (sizeof(thatclass)) and you get your number of
instances allowed to be created...
V
--
Please remove capital As from my address when replying by mail