http://llvm.org/bugs/show_bug.cgi?id=21682

Jean-Daniel Dupas <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #3 from Jean-Daniel Dupas <[email protected]> ---
When I said using a list, I didn't mean a std::list. std::list, like any other
STL structure, will allocate memory and require there destructor to be called
to release it. While TrieNode are allocated by the bumpPtrAllocator, the
TrieNode destructor is never called, and neither is the _children member
destructor.

Moreover, while your patch allocate the TrieEdge using the allocator, it is
then dereferenced and it's content is copied (move) on the list storage, which
is worse than the previous implementation as the freshly allocated Edge is
leaked immediately (the allocated memory will be released when the allocator is
destroyed, but it means the allocation is useless in the first place. An
emplace_back() will be more efficient and have the same effect).

Even using a list<TrieEdge *> will not solve the issue, as the memory allocated
by the list to store the pointer will leaks.

What I though was more something like the solution in the patch from my
previous comment. Note that this is just a proof of concept (ignore whitespace
convention and may probably be improved).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to