Giter Club home page Giter Club logo

Comments (3)

mingyang66 avatar mingyang66 commented on June 18, 2024

我又认真研究了下TTL,其实主线程将值或者引用传递给子线程之后,两个线程之间其实已经是相对独立的状态,主线程清除当前线程的值或引用,不影响子线程的值或引用;

我先在有个问题,如果线程使用过值或引用后不进行remove操作会不会引发OOM?或者引发其它问题?或者是TTL已经帮助做了回收操作?

from transmittable-thread-local.

mingyang66 avatar mingyang66 commented on June 18, 2024

父线程已经执行完了,已经将上下文值引用删除,子线程执行完成后又将父线程的值恢复了,这样会不会造成OOM?

from transmittable-thread-local.

oldratlee avatar oldratlee commented on June 18, 2024

父线程已经执行完了,已经将上下文值引用删除,子线程执行完成后又将父线程的值恢复了,这样会不会造成OOM?

因为「恢复」操作,子线程(的ThreadLocal)不再持有上下文,
所以不会因为这个传递过程而引入内存泄露。 @mingyang66
注意:这里的不包含 Inherit 带给子线程 这和情况。

对于InheritableThreadLocal的内存泄露,有较多讨论,
可以看看网上的讨论或这个库中「内存泄露」相关的issue.

from transmittable-thread-local.

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.