Coder Social home page Coder Social logo

Comments (1)

tmadlener avatar tmadlener commented on July 23, 2024

So there are two different "large" memory leaks, depending on whether we are writing or reading. Large in this case means that memory is leaked for every event. Additionally, there are a few "small" leaks, where we leak only once for the whole execution. (There are also a few other leaks from within the depths of ROOT, but those or not really our concern, I suppose).

The small ones:

  • m_table in EventStore (see #134 for a fix)
  • temporary l_table in ROOTReader::openFiles (see #135 for a fix)

The large ones:

  • When reading we leak all the metadata pointers that are newly allocated by the readers, because, even though the EventStore doesn't really take ownership of the data provided by the reader, but instead copies the data into its members. E.g. here:

    podio/src/EventStore.cc

    Lines 89 to 97 in d4a0265

    GenericParameters& EventStore::getEventMetaData() const {
    if( m_reader != nullptr ){
    m_evtMD.clear() ;
    GenericParameters* tmp = m_reader->readEventMetaData() ;
    m_evtMD = *tmp ;
    }
    return m_evtMD ;
    }

    Moving the data into the internal member and deleting the temporary pointer, fixes this (also fixed in #134)
  • When writing the situtation is a bit more complex. Memory is leaked when we create objects with VectorMembers (potentially others too, but definitely with these) outside of collections and then add them to collections via push_back, e.g. in the form of
ExampleWithVectorMemberCollection coll;
auto vec = ExampleWithVectorMember();
coll.push_back(vec)

The problem is that as soon as we push the vec to the collection, it becomes tracked by the collection, and the deconstructor will only delete the internal vector in ExampleWithVectorMemberObj that is allocated via new if it is not tracked. The collection should in principle do this, but does not do it at the moment. Assuming that the object can become invalid as soon as the collection is cleared, then the fix is simply to make the collection properly clean up all its related memory (this is also implemented in #134).

from podio.

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.