Giter Club home page Giter Club logo

Comments (3)

mslijepc avatar mslijepc commented on July 23, 2024

Or the memory management is the responsibility of find_or_create ?

from systemc-components.

eyck avatar eyck commented on July 23, 2024

Indeed this is a memory leak. The fsm handles are created at https://github.com/Arteris-IP/tlm2-interfaces/blob/48e2de7033275bfc1807925e96154d43325a7325/axi/fsm/base.cpp#L53. Once the bus transaction is finished they are returned into a pool of handles (https://github.com/Arteris-IP/tlm2-interfaces/blob/48e2de7033275bfc1807925e96154d43325a7325/axi/fsm/base.h#L165) and reused from there. But this pool is not free'd upon destruction thus in principle creating a memory leak. Since there is no dynamic instantiation of modules (and hence axi fsms) we did not see this critical yet.

from systemc-components.

mslijepc avatar mslijepc commented on July 23, 2024

One proposal to fix it:

base.h

std::vector<std::unique_ptr<axi::fsm::fsm_handle>> allocated_ptrs;

base.cpp (need slight modification of axi::fsm::fsm_handle, since there is also potential memory leak)

auto* fsm_hndl = create_fsm_handle();
allocated_ptrs.emplace_back(fsm_hndl);
fsm_hndl->fsm = std::make_shared<AxiProtocolFsm>();

from systemc-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.