AccumulateTelemetryCallback leaks at shutdown

RESOLVED DUPLICATE of bug 717630

Status

()

Toolkit
Telemetry
RESOLVED DUPLICATE of bug 717630
6 years ago
6 years ago

People

(Reporter: bholley, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
When running a single XPConnect xpcshell test under valgrind, I noticed some leaks.

I can reproduce this by executing the following in my objdir:
SOLO_FILE=test_params.js make EXTRA_TEST_ARGS="--debugger valgrind --debugger-args '--smc-check=all --trace-children=yes --leak-check=full'" -C js/xpconnect/tests check-one

Here are the leaks I see:
==43898== 30 bytes in 1 blocks are possibly lost in loss record 792 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0974: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x10D5461: AccumulateTelemetryCallback(int, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x200006A: js::gcstats::Statistics::endGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E49204: js::gcstats::AutoGC::~AutoGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E3C81B: js_GC(JSContext*, JSCompartment*, JSGCInvocationKind, js::gcstats::Reason) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 35 bytes in 1 blocks are possibly lost in loss record 951 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0974: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x10D5470: AccumulateTelemetryCallback(int, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x2000090: js::gcstats::Statistics::endGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E49204: js::gcstats::AutoGC::~AutoGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E3C81B: js_GC(JSContext*, JSCompartment*, JSGCInvocationKind, js::gcstats::Reason) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 36 bytes in 1 blocks are possibly lost in loss record 958 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0974: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x10D547F: AccumulateTelemetryCallback(int, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x20000B6: js::gcstats::Statistics::endGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E49204: js::gcstats::AutoGC::~AutoGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E3C81B: js_GC(JSContext*, JSCompartment*, JSGCInvocationKind, js::gcstats::Reason) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 40 bytes in 1 blocks are possibly lost in loss record 990 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0974: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x18876F5: nsCycleCollector::CleanupAfterCollection() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x18893AB: nsCycleCollector::Collect(unsigned int, nsICycleCollectorListener*) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889BCE: nsCycleCollector::Shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889C9C: nsCycleCollector_shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 
==43898== 42 bytes in 1 blocks are possibly lost in loss record 993 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0A22: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x10D5452: AccumulateTelemetryCallback(int, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x2000044: js::gcstats::Statistics::endGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E49204: js::gcstats::AutoGC::~AutoGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E3C81B: js_GC(JSContext*, JSCompartment*, JSGCInvocationKind, js::gcstats::Reason) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 44 bytes in 1 blocks are possibly lost in loss record 999 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0A22: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x10D5443: AccumulateTelemetryCallback(int, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x2000031: js::gcstats::Statistics::endGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E49204: js::gcstats::AutoGC::~AutoGC() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1E3C81B: js_GC(JSContext*, JSCompartment*, JSGCInvocationKind, js::gcstats::Reason) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 50 bytes in 1 blocks are possibly lost in loss record 1,329 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0974: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1887731: nsCycleCollector::CleanupAfterCollection() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x18893AB: nsCycleCollector::Collect(unsigned int, nsICycleCollectorListener*) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889BCE: nsCycleCollector::Shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889C9C: nsCycleCollector_shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 53 bytes in 1 blocks are possibly lost in loss record 1,331 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0974: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x188771D: nsCycleCollector::CleanupAfterCollection() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x18893AB: nsCycleCollector::Collect(unsigned int, nsICycleCollectorListener*) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889BCE: nsCycleCollector::Shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889C9C: nsCycleCollector_shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 60 bytes in 1 blocks are possibly lost in loss record 1,759 of 2,987
==43898==    at 0xB823: malloc (vg_replace_malloc.c:266)
==43898==    by 0x67A368D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6790809: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x67922F9: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x6792411: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.6.0.9.dylib)
==43898==    by 0x13B0974: (anonymous namespace)::HistogramGet(char const*, unsigned int, unsigned int, unsigned int, unsigned int, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0BA9: (anonymous namespace)::GetHistogramByEnumId(mozilla::Telemetry::ID, base::Histogram**) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x13B0C59: mozilla::Telemetry::Accumulate(mozilla::Telemetry::ID, unsigned int) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1887709: nsCycleCollector::CleanupAfterCollection() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x18893AB: nsCycleCollector::Collect(unsigned int, nsICycleCollectorListener*) (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889BCE: nsCycleCollector::Shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898==    by 0x1889C9C: nsCycleCollector_shutdown() (in /files/mozilla/build/c/toolkit/library/XUL)
==43898== 
==43898== 
==43898== 
==43898== 
==43898==

Comment 1

6 years ago
I suppose we can free the histograms while we write them out to disk
Depends on: 707320

Comment 2

6 years ago
I wonder why this reports the std:string as leaking. I'm guessing it leaks because of reference counting, but if this reports the string, why isn't the histogram holding onto string being reported?
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 717630
You need to log in before you can comment on or make changes to this bug.