Opened 8 years ago

Last modified 5 years ago

#10954 new Bugs

boost::spirit::iterator_policies::split_std_deque memory leak on reference count

Reported by: daniel.f.starke@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.57.0 Severity: Problem
Keywords: iterator memory leak spirit multi_pass Cc:

Description

The split_std_deque implementation does not free unsued memory if only one reference to it remains. This is even true when invoking clear_queue(). See attaches example for more details.

Attachments (1)

split_std_deque.cpp (1.5 KB ) - added by split_std_deque 8 years ago.
example causing the memory leak

Download all attachments as: .zip

Change History (2)

by split_std_deque, 8 years ago

Attachment: split_std_deque.cpp added

example causing the memory leak

comment:1 by Nikita Kniazev <nok.raven@…>, 5 years ago

I can confirm the problem.

Once the iterator count goes down to one, and the queue is no longer needed, it is cleared, freeing up memory - actually both of statements found in documentation are violated:

  1. The queue is not cleared in this case (but manual clear_queue() works)
  2. Because split_std_deque is actually implemented on top of std::vector it does not return memory to system upon calling clear() (the shrink_to_fit() call appeared only on C++11)
Note: See TracTickets for help on using tickets.