https://bugs.kde.org/show_bug.cgi?id=369468

            Bug ID: 369468
           Summary: Implement HT_remove_at_Iter, allows removing the
                    current entry from a table during iteration
           Product: valgrind
           Version: 3.12 SVN
          Platform: unspecified
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: ruurd.beers...@infor.com

Created attachment 101328
  --> https://bugs.kde.org/attachment.cgi?id=101328&action=edit
Add HT_remove_at_iter function

The HT_Next iterator can be used to find items to be removed from a list using
HT_remove.
However, after the remove the iterator is considered "not OK" and so needs to
be restarted, leading to quadratic behavior.
Attached patch adds a HT_remove_at_Iter function which removes the current item
from the table, whilst leaving the iterator in the proper state so HT_Next will
return the item after the just-removed one.
The function is used in free_mallocs_in_mempool_block which is now much
simplified and faster, but can be used in other parts of memcheck as well.

The leak-autofreepool.c tst has been updated with a new test-case 6, which
tries to stress the malloc-list search & remove algorithm.
I've tested it manually by setting the verbosity level high and observing that
the HT_remove_at_Iter function removes some (but not all) entries and that all
tests report the expected results.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to