MCPcopy Create free account
hub / github.com/GNOME/gjs / gjs_context_dump_heaps

Function gjs_context_dump_heaps

gjs/context.cpp:172–193  ·  view source on GitHub ↗

Currently heap dumping via SIGUSR1 is only supported on UNIX platforms! This can reduce performance. See note in system.cpp on System.dumpHeap().

Source from the content-addressed store, hash-verified

170// Currently heap dumping via SIGUSR1 is only supported on UNIX platforms!
171// This can reduce performance. See note in system.cpp on System.dumpHeap().
172static void gjs_context_dump_heaps() {
173 static unsigned counter = 0;
174
175 gjs_memory_report("signal handler", false);
176
177 // dump to sequential files to allow easier comparisons
178 Gjs::AutoChar filename{g_strdup_printf("%s.%jd.%u", dump_heap_output.get(),
179 static_cast<intmax_t>(getpid()),
180 counter)};
181 ++counter;
182
183 FILE *fp = fopen(filename, "w");
184 if (!fp)
185 return;
186
187 for (GList* l = all_contexts; l; l = g_list_next(l)) {
188 auto* gjs = static_cast<GjsContextPrivate*>(l->data);
189 js::DumpHeap(gjs->context(), fp, js::CollectNurseryBeforeDump);
190 }
191
192 fclose(fp);
193}
194
195static gboolean dump_heap_idle(void*) {
196 dump_heap_idle_id = 0;

Callers 1

dump_heap_idleFunction · 0.85

Calls 3

gjs_memory_reportFunction · 0.85
contextMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected