There is really no need for CLIDeleter. See<br>
https://youtu.be/c1gO9aB9nbs?t=28m5s<br>
<br>
In short:<br>
// Returns the sole instance of this class.<br>
CLI&amp; CLI::GetSingleton()<br>
{<br>
  static CLI singleton_<br>
  return singleton_;<br>
}<br>
<br>
Should suffice.<br>
<br>
On Sat, Feb 13, 2016 at 3:04 AM, Ryan Curtin &lt;notifications@github.com&gt;<br>
wrote:<br>
<br>
&gt; valgrind shows some invalid accesses too:<br>
&gt;<br>
&gt; [DEBUG] Compiled with debugging symbols.<br>
&gt; [WARN ] Neither --neighbors_file nor --distances_file is specified, so the nearest neighbor search results will not be saved!<br>
&gt; [INFO ] Loading &#39;test_data_3_1000.csv&#39; as CSV data.  Size is 3 x 1000.<br>
&gt; [INFO ] Loaded reference data from &#39;test_data_3_1000.csv&#39; (3 x 1000).<br>
&gt; [INFO ] Building reference tree...<br>
&gt; [INFO ] Tree built.<br>
&gt; [INFO ] Searching for 3 nearest neighbors with dual-tree kd-tree search...<br>
&gt; [INFO ] 18080 node combinations were scored.<br>
&gt; [INFO ] 43890 base cases were calculated.<br>
&gt; [INFO ] Search complete.<br>
&gt; ==24595== Invalid read of size 1<br>
&gt; ==24595==    at 0x71562BA: _IO_file_xsputn@@GLIBC_2.2.5 (in /lib/x86_64-linux-gnu/libc-2.21.so)<br>
&gt; ==24595==    by 0x714C3D8: fwrite (in /lib/x86_64-linux-gnu/libc-2.21.so)<br>
&gt; ==24595==    by 0x651747D: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::__ostream_insert&lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, char const*, long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)<br>
&gt; ==24595==    by 0x8589D9: mlpack::util::PrefixedOutStream::PrefixIfNeeded() (prefixedoutstream_impl.hpp:106)<br>
&gt; ==24595==    by 0x537428B: void mlpack::util::PrefixedOutStream::BaseLogic&lt;std::ostream&amp; (*)(std::ostream&amp;)&gt;(std::ostream&amp; (* const&amp;)(std::ostream&amp;)) (prefixedoutstream_impl.hpp:34)<br>
&gt; ==24595==    by 0x5370F0C: mlpack::util::PrefixedOutStream::operator&lt;&lt;(std::ostream&amp; (*)(std::ostream&amp;)) (prefixedoutstream.cpp:112)<br>
&gt; ==24595==    by 0x535A98E: mlpack::CLI::~CLI() (cli.cpp:71)<br>
&gt; ==24595==    by 0x535B6B8: mlpack::CLI::Destroy() (cli.cpp:249)<br>
&gt; ==24595==    by 0x536FFD4: mlpack::util::CLIDeleter::~CLIDeleter() (cli_deleter.cpp:31)<br>
&gt; ==24595==    by 0x711919E: __cxa_finalize (in /lib/x86_64-linux-gnu/libc-2.21.so)<br>
&gt; ==24595==    by 0x52F1EA2: ??? (in /home/ryan/src/mlpack-tsp/build/lib/libmlpack.so.2.0)<br>
&gt; ==24595==    by 0x400F876: _dl_fini (in /lib/x86_64-linux-gnu/ld-2.21.so)<br>
&gt; ==24595==  Address 0x92d8e92 is 18 bytes inside a block of size 20 free&#39;d<br>
&gt; ==24595==    at 0x4C2B2CB: operator delete(void*) (vg_replace_malloc.c:575)<br>
&gt; ==24595==    by 0x5370747: mlpack::util::PrefixedOutStream::~PrefixedOutStream() (prefixedoutstream.hpp:52)<br>
&gt; ==24595==    by 0x711919E: __cxa_finalize (in /lib/x86_64-linux-gnu/libc-2.21.so)<br>
&gt; ==24595==    by 0x52F1EA2: ??? (in /home/ryan/src/mlpack-tsp/build/lib/libmlpack.so.2.0)<br>
&gt; ==24595==    by 0x400F876: _dl_fini (in /lib/x86_64-linux-gnu/ld-2.21.so)<br>
&gt; ==24595==    by 0x7118E01: __run_exit_handlers (in /lib/x86_64-linux-gnu/libc-2.21.so)<br>
&gt; ==24595==    by 0x7118E54: exit (in /lib/x86_64-linux-gnu/libc-2.21.so)<br>
&gt; ==24595==    by 0x7103876: (below main) (in /lib/x86_64-linux-gnu/libc-2.21.so)<br>
&gt; ==24595==  Block was alloc&#39;d at<br>
&gt; ==24595==    at 0x4C2A16F: operator new(unsigned long) (vg_replace_malloc.c:333)<br>
&gt; ==24595==    by 0x6529496: void std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::_M_construct&lt;char const*&gt;(char const*, char const*, std::forward_iterator_tag) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)<br>
&gt; ==24595==    by 0x65295EB: std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)<br>
&gt; ==24595==    by 0x53706E2: mlpack::util::PrefixedOutStream::PrefixedOutStream(std::ostream&amp;, char const*, bool, bool) (prefixedoutstream.hpp:74)<br>
&gt; ==24595==    by 0x53705AA: __static_initialization_and_destruction_0(int, int) (log.cpp:44)<br>
&gt; ==24595==    by 0x537067C: _GLOBAL__sub_I_log.cpp (log.cpp:130)<br>
&gt; ==24595==    by 0x400F269: call_init.part.0 (in /lib/x86_64-linux-gnu/ld-2.21.so)<br>
&gt; ==24595==    by 0x400F37A: _dl_init (in /lib/x86_64-linux-gnu/ld-2.21.so)<br>
&gt; ==24595==    by 0x4000CC9: ??? (in /lib/x86_64-linux-gnu/ld-2.21.so)<br>
&gt; ==24595==    by 0x5: ???<br>
&gt; ==24595==    by 0xFFF000682: ???<br>
&gt; ==24595==    by 0xFFF000694: ???<br>
&gt; ... (lots more)<br>
&gt;<br>
&gt; —<br>
&gt; Reply to this email directly or view it on GitHub<br>
&gt; &lt;https://github.com/mlpack/mlpack/pull/521#issuecomment-183386914&gt;.<br>
&gt;<br>
<br>
<br>
<br>
-- <br>
Joseph Chakravarti Mariadassou<br>
http://thesundayprogrammer.com<br>


<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/521#issuecomment-183559230">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFDIoU7brHLIlMLMMi-_KwNrvCXxkks5pjoNtgaJpZM4HX7Db.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/521#issuecomment-183559230"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>