Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    1cadeb40
    MAINT-5232: Prevent runaway LLSingletonBase::MasterList growth. · 1cadeb40
    Nat Goodspeed authored
    Until we reimplement LLCoros on Boost.Fiber, we must hand-implement
    coroutine-local data. That presently takes the form of a map keyed on
    llcoro::id, whose values are the stacks of currently-initializing LLSingleton
    instances.
    
    But since the viewer launches an open-ended number of coroutines, we could end
    up with an open-ended number of map entries unless we intentionally prune the
    map. So every time we pop the stack to empty, remove that map entry.
    
    This could result in thrashing, a given coroutine's 'initializing' stack being
    created and deleted for almost every LLSingleton instantiated by that
    coroutine -- but the number of different LLSingletons is necessarily static,
    and the lifespan of each is the entire rest of the process. Even a couple
    dozen LLSingletons won't thrash that badly.
    1cadeb40
    History
    MAINT-5232: Prevent runaway LLSingletonBase::MasterList growth.
    Nat Goodspeed authored
    Until we reimplement LLCoros on Boost.Fiber, we must hand-implement
    coroutine-local data. That presently takes the form of a map keyed on
    llcoro::id, whose values are the stacks of currently-initializing LLSingleton
    instances.
    
    But since the viewer launches an open-ended number of coroutines, we could end
    up with an open-ended number of map entries unless we intentionally prune the
    map. So every time we pop the stack to empty, remove that map entry.
    
    This could result in thrashing, a given coroutine's 'initializing' stack being
    created and deleted for almost every LLSingleton instantiated by that
    coroutine -- but the number of different LLSingletons is necessarily static,
    and the lifespan of each is the entire rest of the process. Even a couple
    dozen LLSingletons won't thrash that badly.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
llsingleton.cpp 17.41 KiB