Forum: GNU Radio Delete a reference to PMT - GRextras

Posted by Jose Torres Diaz (Guest)
on 2013-01-05 02:21
(Received via mailing list)
Hi Community,

I'm working with blob manager to implement our design. The block diagram 
in
GRExtras looks similar to this:

BLOCK 1 --> BLOCK 2 --> BLOCK 3 --> SINK

Where, Block 1 contains the manager as follows:

MsgBlobManager = pmt::pmt_mgr::make();
      for (size_t i = 0; i < MSG_BLOBS_ALLOCATION; i++)
          {

MsgBlobManager->set(pmt::pmt_make_blob(BLOB_MSG_INITIAL_SIZE));
          }


However, when I made some changes in the blob that is passing around in
BLOCK 2 (only 1 field of the blob), in BLOCK 3 I received the old data 
from
BLOCK 1. This happens exactly 3 times until BLOCK 3 received the correct
updated data.

I'm not sure if it is related due to previous blocks are keeping a
reference to the incoming message (as explained in
https://github.com/guruofquality/grextras/wiki#wik...).
What I do not know either is the following:

"Normally, a PMT is created and passed to a downstream consumer. When 
all
downstream consumers delete their references to the PMT, the object is
deconstructed and freed back into nothingness"

1. How the downstream consumer delete their reference to a PMT object?
2. Is it automatically done or should I explicitly do this?

Thanks for your time and advice,

Regards,

Jose.
Posted by Josh Blum (Guest)
on 2013-01-08 02:38
(Received via mailing list)
On 01/04/2013 07:20 PM, Jose Torres Diaz wrote:
>       for (size_t i = 0; i < MSG_BLOBS_ALLOCATION; i++)
>
> 2. Is it automatically done or should I explicitly do this?
>

Its automatic, via deleting all references.

See boost intrusive_ptr
http://www.boost.org/doc/libs/1_52_0/libs/smart_pt...

In the case of the manager, the manager object hold 1 reference. When
you ask the manager for an available pmt, it looks for all objects that
have a reference count of 1. ie the manager is the only reference 
holder.

I hope that helps some understanding.

If you are trying to trace the flow of the messages, you can also print
the pointer underlying object.
std::cout << "ptr to underlying object " << size_t(some_pmt.get())


-josh
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.