| 34 | GJS_FOR_EACH_COUNTER(GJS_LIST_COUNTER)}; |
| 35 | |
| 36 | void gjs_memory_report(const char* where, bool die_if_leaks) { |
| 37 | gjs_debug(GJS_DEBUG_MEMORY, |
| 38 | "Memory report: %s", |
| 39 | where); |
| 40 | |
| 41 | size_t n_counters = G_N_ELEMENTS(counters); |
| 42 | |
| 43 | int64_t total_objects = 0; |
| 44 | for (size_t i = 0; i < n_counters; ++i) { |
| 45 | total_objects += counters[i]->value; |
| 46 | } |
| 47 | |
| 48 | if (total_objects != GJS_GET_COUNTER(everything)) { |
| 49 | gjs_debug(GJS_DEBUG_MEMORY, |
| 50 | "Object counts don't add up!"); |
| 51 | } |
| 52 | |
| 53 | gjs_debug(GJS_DEBUG_MEMORY, " %" PRId64 " objects currently alive", |
| 54 | GJS_GET_COUNTER(everything)); |
| 55 | |
| 56 | if (GJS_GET_COUNTER(everything) != 0) { |
| 57 | for (size_t i = 0; i < n_counters; ++i) { |
| 58 | gjs_debug(GJS_DEBUG_MEMORY, " %24s = %" PRId64, |
| 59 | counters[i]->name, counters[i]->value.load()); |
| 60 | } |
| 61 | |
| 62 | if (die_if_leaks) |
| 63 | g_error("%s: JavaScript objects were leaked.", where); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | int32_t estimate_size_of_gdkpixbuf(GObject* wrapped) { |
| 68 | GI::Repository repo; |
no test coverage detected