title: "~__vector_base() " having an excess run time in Wasm as well as an abort error. Cannot find the error
body: <p>I've make a program to do a login procedure and had it working great, but when I went back and noticed a dynamically allocated variable (an object) not being deleted, I correct that and found my program to be extremely slow, taking about 3 seconds per each step, when it previously was instant. </p>
  
  <p>I compiled in a debug mode, and the first thing I noticed was all the abort() errors being called.</p>
  
  <p><a href="https://i.stack.imgur.com/5LF0F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5LF0F.png" alt="enter image description here"></a></p>
  
  <p>I then ran a profile in chrome tools, giving this result. </p>
  
  <p><a href="https://i.stack.imgur.com/EABuo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EABuo.png" alt="enter image description here"></a></p>
  
  <p>This is the stack trace demangled,</p>
  
  <pre><code>_WoWAuthHandler::handleServerData(WoWPacket*)
     _WoWPacket::~WoWPacket()
        _Packet::~Packet()
           _Buffer::~Buffer()
              _Buffer::clear()
  </code></pre>
  
  <p>This is the code for ~Buffer() (Not my code)</p>
  
  <pre><code>Buffer::~Buffer() {
       clear();
  }
  </code></pre>
  
  <p>Buffer::clear()</p>
  
  <pre><code>void Buffer::clear() noexcept {
      buffer.clear();
      readOffset = 0;
      writeOffset = 0;
  }
  </code></pre>
  
  <p>buffer is a basic std::vector, but the std::vector.clear() isn't included in the stack trace and doesn't seem to be the issue.</p>
  
  <p>I modified ~Buffer() to just be an empty function and ran another profile However, this only made it more confusing.</p>
  
  <p><a href="https://i.stack.imgur.com/em9sb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/em9sb.png" alt="enter image description here"></a></p>
  
  <p>This is the demanged stack trace for that.</p>
  
  <pre><code>_WoWAuthHandler::handleServerData(WoWPacket*)
     _WoWPacket::~WoWPacket()
        _Packet::~Packet()
           _Buffer::~Buffer()
              _std::__2::vector&lt;unsigned char, std::__2::allocator&lt;unsigned char&gt; &gt;::~vector()
                _std::__2::__vector_base&lt;unsigned char, std::__2::allocator&lt;unsigned char&gt; &gt;::~__vector_base()
  </code></pre>
  
  <p>~Buffer() does not call anything.</p>
  
  <p>I can control this massive delay from happening, but it involves removing the delete call on that first variable. Not being an option, as that variable is dynamically created. </p>
  
  <pre><code>void Socket::serverToHandler(int dataptr, int len) {
      uint8_t* dataraw = (uint8_t*)dataptr;
      std::vector&lt;uint8_t&gt;* dataParsed = Socket::parsePacket(dataraw, len);
  
      WoWPacket* dataReader = new WoWPacket(dataParsed);
      wowHandler-&gt;handleServerData(dataReader);
      delete dataReader;//If this is removed, the code runs without issue. However, it lags a huge amount with it. 
  
      delete dataraw;
      delete dataParsed;
  }
  </code></pre>