Closed
Bug 1149399
Opened 10 years ago
Closed 10 years ago
Leaking name16 in JS::ubi::SimpleEdgeVectorTracer?
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: fitzgen, Assigned: fitzgen)
References
(Blocks 1 open bug)
Details
// The simplest code is correct! The temporary SimpleEdge takes
// ownership of name; if the append succeeds, the vector element
// then takes ownership; if the append fails, then the temporary
// retains it, and its destructor will free it.
if (!vec->append(mozilla::Move(SimpleEdge(name16, Node(kind, *thingp))))) {
okay = false;
return;
}
However, name16 is just a char16_t*, not some kind of RAII smart pointer, so it doesn't have a dtor that cleans up after itself.
Am I missing something?
Asan is reporting leaks pointing here in my heap snapshot try pushes. Do we not exercise this code path currently?
Assignee | ||
Comment 1•10 years ago
|
||
Jim, see comment 0.
Blocks: memory-platform, 1024774
Flags: needinfo?(jimb)
Comment 2•10 years ago
|
||
(In reply to Nick Fitzgerald [:fitzgen] from comment #0)
> // The simplest code is correct! The temporary SimpleEdge takes
> // ownership of name; if the append succeeds, the vector element
> // then takes ownership; if the append fails, then the temporary
> // retains it, and its destructor will free it.
> if (!vec->append(mozilla::Move(SimpleEdge(name16, Node(kind,
> *thingp))))) {
> okay = false;
> return;
> }
>
> However, name16 is just a char16_t*, not some kind of RAII smart pointer, so
> it doesn't have a dtor that cleans up after itself.
The SimpleEdge and Node constructors never fail, so SimpleEdge(name16, ...) is guaranteed to construct a SimpleEdge. SimpleEdge is documented to take ownership of the name:
https://hg.mozilla.org/mozilla-central/file/c20f8549d631/js/public/UbiNode.h#l441
and hence from that point forward the string is owned by some SimpleEdge, whose destructor will free it.
I'm curious about these ASan failures. I'll find you on IRC.
Flags: needinfo?(jimb)
Assignee | ||
Updated•10 years ago
|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•