Git Product home page Git Product logo

Comments (5)

jayvdb avatar jayvdb commented on June 15, 2024

#3 is sort of related, and on its way to being solved.

I think .close() would have similar effect on memory consumption, as all buffers are released, but worth checking.

from stdio-mgr.

bskinn avatar bskinn commented on June 15, 2024

In most modern contexts, for anything but the most ridiculous of large streams, I can't imagine this Issue is likely to be a big issue. Seems very YAGNI.

Especially with the changes from #25 and #26, though -- as you noted at the bottom of #26, the mocked stream objects are now storing internal references to the underlying buffers in some situations, and that could lead to memory accumulation if enough things stay in scope/have references.

from stdio-mgr.

bskinn avatar bskinn commented on June 15, 2024

Although -- both RandomTextIO and TeeStdin store a reference to the buffer in ._buf... as long as the (i, o, e) objects remain in scope, I would think they will retain references to their ._bufs the whole time, even after .close() or .detach(), right?

I guess .close() frees the actual buffer memory, so in that case it is just ._closed_buf to worry about in terms of memory consumption.

But for .detach(), I'd think it would still matter -- though, if someone is .detach()-ing, they likely still want to work with the stream data, and so it would probably be a total footgun to wipe the buffer after just a .detach().

So, yeah: just ._closed_buf to worry about, then.

from stdio-mgr.

bskinn avatar bskinn commented on June 15, 2024

With #58 switching the persisted-content mechanism from ._closed_buf to a callback, this issue should be moot.

from stdio-mgr.

jayvdb avatar jayvdb commented on June 15, 2024

I think we at least need tests for this, and it turns out to be very important to delete objects when using TemporaryFile and when using the real sys handles.

from stdio-mgr.

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.