Unmarked memory leak in vuejs application

I tried to solve this problem for a while, I even gave him the option to rewrite the whole program, but to no avail. The app runs on VueJS 2.3.3 and needs to run on Chromium in conjunction with a Raspberry Pi (irrelevant information, for now).

We are working with several components that are included in one file, later this file will be compiled using gulp

or npm run dev

. When initializes an instance VueJS

, the request will be sent using a parameter Vue Resource

$http

. This will get a json response with a size of about 30mb

. This will be stored in the dataset as shown here:

this.$http.get('<url>' + this.token)
    .then((response) => {
        this.properties = response.properties;
    });

      

In the future, this data will be used for further actions, another thing worth mentioning is that the data is updated every time. I think the problem occurs if I don't refresh the data every 5 minutes (maybe more, really depends on how I test) the program works fine. I just want to update the data every time to get new information. The method for setting the timeout that I am using is as follows:

this.dataTimeout = setTimeout(this.refreshData, 300000); 

      

Each (so called) property

has at least 6 base64 images stored in JSON, which are later used to present to the user. In addition, there is a name, an address, and some other tiny bits of data. It doesn't sound like that, but I feel like each answer is causing the memory to grow so intensely that even the desktop has trouble starting it up.

Every 10 seconds, a new one will be displayed on the user's screen property

, including images, street, location, etc. I'm not sure if there is a memory leak in my code or if I am forgetting something. Several questions popped up in my head:

  • Do I need to reset the response I receive from the server to null

    or undefined

    ?
  • Could there be a leak in one of the plugins (Just VueResources)?
  • How long can an instance remain VueJS

    , is there a recommended time to restart the entire program?
  • What should I take into account in order to achieve this?

I pulled the update data and posted a demo project online, you can see it on the right here . The main problem I'm running into is that the browser is running out of memory and showing us an awesome page Aw snap!

from Chrome. I tried to take snapshots from memory but it all seems fine, it just explodes accidentally after a while.

Thanks, advanced!

+3


source to share


1 answer


Well, I don't know what your application really does, but is your 30Mb of data really useful / necessary? In JSON besides?

You may not need all of this data, and you can simply tailor the data to your needs. For example, save your JSON store data and load Base64 images in a different way.

I don't understand why you are storing in memory images. Images are useful for display in my opinion.



So, I think 30Mb is really huge. But maybe I'm wrong?

BTW, I tested with Firefox Nightly, no problem. It seems this is not a wreck. Maybe I am not meeting the update challenge?

0


source







All Articles