CKEditor

Memory leaks with mathjax

HTML

<script src="https://cdn.ckeditor.com/4.5.5/standard-all/ckeditor.js"></script>
<textarea name="editor1">
  
    <p>Just some text.</p>

<p>Chrome devtools -&gt; Profiles -&gt; <strong>Take Heap Snapshot</strong></p>

<p>It should be around 60mb!!!</p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

  <p><span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p>

</textarea>

<button id="remove">
  Remove Editor
</button>
</button>

SCSS

#remove {
  margin-top: 20px;
  padding: 20px;
  font-size: 15px;
  background-color: block;
  color: black;
  border-radius: 10px;
  &:hover {
    cursor: pointer;
    background-color: grey;
  }
}

JavaScript

CKEDITOR.config.extraPlugins = 'mathjax';
CKEDITOR.config.mathJaxLib = '//cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML';

CKEDITOR.replace('editor1');

document.getElementById('remove').onclick = function() {
   CKEDITOR.instances['editor1'].destroy(true);
};