<table><tr><td style="">bruns created this revision.<br />bruns added reviewers: Baloo, ngraham, astippich, poboiko, broulik.<br />Herald added projects: Frameworks, Baloo.<br />Herald added a subscriber: kde-frameworks-devel.<br />bruns requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D21581">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The mmap size supported by valgrind is set at valgrind compile time. If<br />
the application tries to mmap in total more than the supported size,<br />
the mmap fails. As a result lmdb fails to open the DB which is<br />
interpreted as a broken DB, thus the DB is deleted.</p>

<p>Valgrind can be detected at runtime using the RUNNING_ON_VALGRIND<br />
macro from valgrind.h, which is added to the sources:</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>You are encouraged to copy the valgrind/*.h headers into your project's</p></blockquote>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">include directory, so your program doesn't have a compile-time
dependency on Valgrind being installed. The Valgrind headers, unlike
most of the rest of the code, are under a BSD-style license so you may
include them without worrying about license incompatibility.</pre></div></div></div><br /><div><strong>TEST PLAN</strong><div><p>valgrind --tool=callgrind baloo_file</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>org.kde.baloo.engine: Valgrind detected, limiting DB mmap to 40 GByte</p></blockquote></div></div><br /><div><strong>REPOSITORY</strong><div><div>R293 Baloo</div></div></div><br /><div><strong>BRANCH</strong><div><div>base</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D21581">https://phabricator.kde.org/D21581</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/engine/database.cpp<br />
src/engine/valgrind.h</div></div></div><br /><div><strong>To: </strong>bruns, Baloo, ngraham, astippich, poboiko, broulik<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams<br /></div>