Currently heap dumping via SIGUSR1 is only supported on UNIX platforms! This can reduce performance. See note in system.cpp on System.dumpHeap().
| 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(). |
| 172 | static 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 | |
| 195 | static gboolean dump_heap_idle(void*) { |
| 196 | dump_heap_idle_id = 0; |
no test coverage detected