From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Pointers explained?
Date: Mon, 30 Jul 2007 22:11:10 +0200
Date: 2007-07-30T22:10:52+02:00 [thread overview]
Message-ID: <1u6yxxpe3777x.qmvqq9xczlwy.dlg@40tude.net> (raw)
In-Reply-To: 1185817996.143086.317990@g12g2000prg.googlegroups.com
On Mon, 30 Jul 2007 10:53:16 -0700, shaunpatterson@gmail.com wrote:
> Now from my factory create method, I'm returning a Message_Class.
> This message_class is stored in another record to be handled again later:
>
> type CallbackEvent is
> record
> msg : Message_Class;
> ...
> end record;
Are you sure that you want to copy messages? Let there are 10000
subscribers to a messages publisher. Then upon emitting a message you will
copy it 10000 times!
I would consider:
type CallbackEvent (Message : access Message'Class) is
> Now my basic problem -- or not really a problem -- is that to create
> the Message_Class I have to use "new" and allocate and deallocate memory.
> Now - my solution was to re-write my message factory to return a type
> Message'Class. However, I went
> to change my callback structure to:
No problem, leave factory as-is, returning Message'Class. Whenever you
would need to allocate Message, you could still do it like this:
new Message'Class'(Factory (...));
Factory returns Message'Class used to initialize the memory allocated for
the new object.
> type CallbackEvent is
> record
You could consider making reference counted Messages and handles to them.
Handles will be copied around and placed into containers like
CallbackEvent.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-07-30 20:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-30 17:53 Pointers explained? shaunpatterson
2007-07-30 17:56 ` shaunpatterson
2007-07-30 19:04 ` Ed Falis
2007-07-30 19:05 ` Ludovic Brenta
2007-07-30 19:36 ` Adam Beneschan
2007-07-30 21:23 ` Maciej Sobczak
2007-07-30 22:36 ` Adam Beneschan
2007-07-31 7:33 ` Dmitry A. Kazakov
2007-07-31 1:15 ` Anh Vo
2007-07-30 22:20 ` Adam Beneschan
2007-07-30 21:31 ` Jeffrey R. Carter
2007-07-31 17:21 ` Simon Wright
2007-07-31 18:06 ` Dmitry A. Kazakov
2007-07-31 22:38 ` shaunpatterson
2007-08-01 7:53 ` Martin Krischik
2007-08-01 8:21 ` Dmitry A. Kazakov
2007-08-10 19:52 ` Simon Wright
2007-07-30 20:11 ` Dmitry A. Kazakov [this message]
2007-07-31 8:28 ` Martin Krischik
-- strict thread matches above, loose matches on Subject: below --
2007-07-30 17:53 shaunpatterson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox