Image objects remain in RAM after .remove ()?

I have a website with a lot of great photos that are always set in html. how

<div><img src="sample1.jpg"></div> <div><img src="sample2.jpg"></div> <div><img src="sample3.jpg"></div> <div><img src="sample4.jpg"></div> .... 

This makes the site very slow. Even the .animate () function works with problems. Therefore, I decided to upload only 5 images, and the rest were uploaded on request. The problem is that when loading too many images, the website becomes slow again. Question:

If I use the .remove () function to delete all the images around the displayed one, will the images still remain in RAM, or will they be deleted and again removed from the cache when I add the image?

Hope the question is clear, thanks in advance.

+6
source share
1 answer

You cannot force anything to be removed from browsers' active memory using Javascript / jQuery, however, as other users said when using .remove (), deleted items are then garbage collected.

I think it is unlikely that these images will cause the slowdown that you see, and rather, a problem with some of your other scripts.

I assume that you are slowing down your value, such as page lag, indicating memory / processor usage.

If the problem is the actual page load time, the problem lies elsewhere and has nothing to do with the RAM that was taken, but is most likely related to loading the images if it is possible to delete unnecessary images on the server side.

+1
source

Source: https://habr.com/ru/post/945360/


All Articles