Is it possible to unload a fetched JSON file from a web browser?

28 Views Asked by At

I have a web application that loads very large JSON files via the fetch() api, but there does not seem to be a way to clear them from memory when the program no longer needs them. Is there a method of dynamically unloading fetched files from system memory to prevent poor performance? I am aware that resetting the variable clears the JSON from it, but the file still lingers in memory. The method I am using to get JSON files is simply var JSONvar = fetch(http://api.website.com/files/JSONfile.json)

I have tried searching online for any solutions and have come across methods for unloading/reloading javascript files (discussed here) directly embedded in the HTML document, but I do not believe a similar method exists for JSON loaded into javascript variables. I am aware that window.onunload exists, but I am not sure how to force anything to unload.

0

There are 0 best solutions below