Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-05

per-class memory manager

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Aleksey V. Vaneev

Hello,

Sorry, if this question was/is discussed somewhere. I just wanted to ask if it is possible to assign to a class a custom memory manager. Sometimes it is very efficient to allocate objects on a static memory pool.

And the accompanying question - how to get object's size? Can I safely use class function InstanceSize?

Best regards,
Aleksey

Unknown author
to Aleksey V. Vaneev
Aleksey V. Vaneev wrote 5 lines
Hello, Sorry, if this question was/is discussed somewhere. I just wanted to ask if it is possible to assign to a class a custom memory manager.

It is not possible.

Sometimes it is very efficient to allocate objects on a static memory pool.

Maybe, but if a descendent of the object would be made, then the size would increase, and this would create problems with the static memory pool.

And the accompanying question - how to get object's size? Can I safely use class function InstanceSize?

Yes.

Michael.

Aleksey V. Vaneev

Hello,

> Sorry, if this question was/is discussed somewhere. I just wanted to > ask if it is possible to assign to a class a custom memory > manager. It is not possible.

BTW, I've found a working way using getinstance and freeinstance. It worked for me. But...

> Sometimes it is very efficient to allocate objects on a > static memory pool. Maybe, but if a descendent of the object would be made, then the size would increase, and this would create problems with the static memory pool.

Yes, this is a problem, but if class somehow "embedded" there is no real problem (of course if everything that's necessary is documented).

Best regards,
Aleksey