hexo icon indicating copy to clipboard operation
hexo copied to clipboard

Hexo eats all the memory when generating

Open steveww opened this issue 6 years ago • 8 comments

I am building image gallery site. It will have many large images, at the moment with just a small percentage of the images loaded Hexo uses all computer memory when generating the site.

Machine is Linux quad core with 8GB of memory. Hexo eats it all and brings the machine to a standstill due to excessive swapping.

There are 5.7GB of image files. About 1k images.

Looks like Hexo loads everything into memory to generate the site. This is insane!

steveww avatar Nov 27 '19 18:11 steveww

Please try concurrency option.

https://hexo.io/docs/commands#generate

yoshinorin avatar Nov 28 '19 10:11 yoshinorin

Hexo doesn't know what files inside source folder should be used during generation, thus Hexo loads everything under source folder.

Try to configure skip_render in your _config.yml to exclude your images to see if it helps.

SukkaW avatar Nov 29 '19 16:11 SukkaW

None of the suggestions made any difference. About 1.5GB of memory is used for generate which is about the size of the directory including all the images. I have my suspicions about the filter https://github.com/hexojs/hexo-filter-responsive-images I think it may be the culprit. I think it may be loading every image into memory to resize them.

steveww avatar Nov 29 '19 17:11 steveww

https://github.com/hexojs/hexo-filter-responsive-images I think it may be the culprit. I think it may be loading every image into memory to resize them.

Does disabling the plugin helped?

curbengh avatar Dec 06 '19 06:12 curbengh

I disabled the plugin but it make very little difference.

steveww avatar Dec 06 '19 10:12 steveww

I would like to reproduce this. May I know your folder structure, specifically where you put the images (source/, themes/foo/source/, etc)? How do you organize the posts? Do you enable post_asset_folder?

curbengh avatar Dec 07 '19 00:12 curbengh

I did not use post_asset_folder. Each post represents a different gallery, which is dynamically built using my script. This just lists the target folder and creates a justified-gallery DIV. I've attached a recursive list of the folder structure.

ls.txt.gz

Here is my script. tag-imgdir.js.gz

The more images I add the more memory hexo takes when generating.

steveww avatar Dec 07 '19 16:12 steveww

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 05 '20 21:02 stale[bot]

I found that the external_link filter is consuming a huge amount of memory. You can try to disable it in _config.yml

external_link:
  enable: false

stevenjoezhang avatar Nov 28 '22 07:11 stevenjoezhang

I'm closing this issue due to inactivity. You can join the discussion here: https://github.com/hexojs/hexo/issues/4922

stevenjoezhang avatar Jul 14 '23 02:07 stevenjoezhang