Commit 6d25dbeb authored by Philip Chimento's avatar Philip Chimento

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.)
parent 2d59f7e4
...@@ -287,6 +287,7 @@ gjs_context_class_init(GjsContextClass *klass) ...@@ -287,6 +287,7 @@ gjs_context_class_init(GjsContextClass *klass)
void GjsContextPrivate::trace(JSTracer* trc, void* data) { void GjsContextPrivate::trace(JSTracer* trc, void* data) {
auto* gjs = static_cast<GjsContextPrivate*>(data); auto* gjs = static_cast<GjsContextPrivate*>(data);
JS::TraceEdge<JSObject*>(trc, &gjs->m_global, "GJS global object"); JS::TraceEdge<JSObject*>(trc, &gjs->m_global, "GJS global object");
gjs->m_atoms.trace(trc);
} }
void GjsContextPrivate::warn_about_unhandled_promise_rejections(void) { void GjsContextPrivate::warn_about_unhandled_promise_rejections(void) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment