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

Function gjs_memory_report

gjs/mem.cpp:36–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 GJS_FOR_EACH_COUNTER(GJS_LIST_COUNTER)};
35
36void 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
67int32_t estimate_size_of_gdkpixbuf(GObject* wrapped) {
68 GI::Repository repo;

Callers 2

gjs_context_dump_heapsFunction · 0.85
mainFunction · 0.85

Calls 2

gjs_debugFunction · 0.85
loadMethod · 0.80

Tested by

no test coverage detected