<p>In <a href="https://github.com/mlpack/mlpack/pull/664#discussion_r67884494">src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp</a>:</p>
<pre style='color:#555'>&gt;    if (deepCopy)
&gt;    {
&gt;      if (numChildren &gt; 0)
&gt;      {
&gt;        for (size_t i = 0; i &lt; numChildren; i++)
&gt; -      {
&gt;          children[i] = new RectangleTree(*(other.Children()[i]));
</pre>
<p>I know this is not your code, but I wanted to see if you thought the same thing here... I think this may duplicate the dataset many times, if I do the following:</p>

<pre><code>RTree&lt;...&gt; r(dataset); // makes lots of nodes
RTree&lt;...&gt; otherR(r, true /* deep copy */);
</code></pre>

<p>This will recursively call this constructor with <code>deepCopy = true</code>, copying the dataset every single time.  Is my understanding correct there?  If so, I'll open an issue about that separately (no need to fix it here, I think it might take a little thought).</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/664/files/f9127cea62d5ce1ad8d5f59931de108a2f7cdd9b#r67884494">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFBXOEgk1jdGCkdVMQP7-EJN_QHdnks5qN_t2gaJpZM4IrlzT">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFM7EiJBgeuP_Cm9o8IZKL6dBCW3Jks5qN_t2gaJpZM4IrlzT.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/664/files/f9127cea62d5ce1ad8d5f59931de108a2f7cdd9b#r67884494"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>