How to completely destroy a complex object from memory (online chat + Nuxt)?

I use Nuxt with SSR and integrated to the online chat support, which by default does not have API to update the user's current location on the website (i.e., not SPA sites all will work perfectly, as with each loading of page the object is created again chat).

That is, on normal sites when you change the page, desborde chat page is displayed on which the user came from-in live mode, and SSR when chat is initialized once and not reload the current route of the user.

Until I came to the conclusion that the change of route, since there is no official method .desctroy() or .update(), you must personally destroy the object chat.

methods: {
 startTawk() {
 var Tawk_API = Tawk_API || {}, Tawk_LoadStart = new Date();
 let el = this.$el;

 (function () {
 var s1 = document.createElement("script"),
 s0 = document.createElement("div"),
 body = document.querySelector("body");

 s1.async = true;
 s1.src = '';
 s1.charset = 'UTF-8';
 s1.setAttribute('by adding crossorigin', '*');
 destroyTawk() {
 let tawk = document.querySelector("body div > iframe");
 let script = document.querySelector(".TAWK_SCRIPT_CONTAINER");

 if (!tawk || !script) {
 console.log('Tawk' not found');
 } else {
 tawk = tawk.parentNode;


 delete window.$_Tawk;
 delete window.$_Tawk_AccountKey;
 delete window.$_Tawk_Unstable;
 delete window.$_Tawk_WidgetId;
 delete window.$__TawkEngine;
 delete window.$__TawkSocket;
 delete window.TawkClass;
 delete window.Tawk_API;
watch: {
 '$route.path': function () {

In this scenario, everything starts to work, but will naturally start to clog the memory (about 20MB for a change of route). As I recall, that would destroy the object from memory, that would have been lost all object references, and so deleting I obviously don't remove the links.

What can I do? There is a solution, besides that necessary to knock on support (what has been done, but they don't answer, and realization lit)?
April 3rd 20 at 18:24
2 answers
April 3rd 20 at 18:26
The idea is your delete should do the same as assigning null (I mean from the point of view of memory) — but this is not accurate.
Here is more information:

And besides, why every time you change routes anything at all to recreate — is it not possible to use once created object at all ranting?
This object does not have interface updates the current location of the User, which is very important - Petra.OHa commented on April 3rd 20 at 18:29
April 3rd 20 at 18:28
if somewhere saved a reference to one of these objects, then the delete will not help.
even if its not - then delete the memory is not freed immediately, but at some random point in time
In General, you do not control the allocation of memory and the only way to accurately verify that the object deleted is to popratiloff hands, run the garbage collector and making sure that the libs really are removed.

Find more questions by tags JavaScriptNuxt.js