mixedbag99
mixedbag99

Reputation: 529

Node-Webkit Application: Loading thousands of images from disk

I have created a node-webkit application that loads thousands of images (7,480 to be exact) from disk into an HTML table. After about 3500 images, the loading stops. In the console, I see ERR_INSUFFICIENT_RESOURCES. According to Task Manager, the memory (private working set) for my app is at around 1.37 GB when this happens. How can I prevent this from happening? Is there a way for me to increase this limit? What additional details should I provide to receive help?

Upvotes: 0

Views: 61

Answers (1)

Fire Crow
Fire Crow

Reputation: 7729

In the past when i have faced a similar problem, i held the images in memory, and inserted them into the dom as they scrolled into view.

I created two queues one for images not the scroll down to, and one for images that have been scrolled past. this way only images that are visible are present in the page.

If the download time is an issue try loading them into memory and see what happens, there is a chance the limit you have encountered is about placing images in the dom, and not necessarily loading the images into memory, worth a try.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image

var myImage = new Image(100, 200);
myImage.src = 'picture.jpg';

Upvotes: 1

Related Questions