Jump to content

I use tlm_extension to set/get trans extension, when does the memeory I new to delete?

Recommended Posts

OK. I have read the source code of systemc. And I found that ~tlm_generic_payload will call extension free.




// Destructor


tlm_generic_payload::~tlm_generic_payload() {

    for(unsigned int i=0; i<m_extensions.size(); i++)

        if(m_extensions[i]) m_extensions[i]->free();




Link to comment
Share on other sites

This depends slightly on the coding style (Loosely timed (LT) vs Approximately Timed (AT)) and the extension classification. For AT, if you use the auto-extension mechanism, then the memory manager can do this for you. For sticky extensions, you don't remove the extension at all because it gets reused. For LT, it should be done in the component that creates the extension when the transaction is closing.

This is a relatively complex topic, which is covered in the Doulos TLM Adopter course, among other places.

[Note: I work as an instructor at Doulos.]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...