[gjs: 1/10] context: Trace atoms



commit 6d25dbeb81221bd2465b1ce6828e300510cb7a2a
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Feb 23 22:41:51 2019 -0800

    context: Trace atoms
    
    Apparently I forgot to trace these. It didn't affect most of the members
    of GjsAtoms because string atoms are pinned in memory anyway. But the
    symbol atoms only had their symbol descriptions pinned in memory, not
    the symbols themselves. So garbage collections would collect these
    symbols.
    
    This wasn't obvious because the symbols seem only to be used early in
    the GJS process anyway. It became apparent when running with JS_GC_ZEAL
    (extra garbage collection after every 100 allocations.)

 gjs/context.cpp | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 922cd7bb..57353759 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -287,6 +287,7 @@ gjs_context_class_init(GjsContextClass *klass)
 void GjsContextPrivate::trace(JSTracer* trc, void* data) {
     auto* gjs = static_cast<GjsContextPrivate*>(data);
     JS::TraceEdge<JSObject*>(trc, &gjs->m_global, "GJS global object");
+    gjs->m_atoms.trace(trc);
 }
 
 void GjsContextPrivate::warn_about_unhandled_promise_rejections(void) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]