I think I managed to fix this issue partially. Not yet perfect but I can generate thumbs for 4k images. And this is with device with 2 GB of ram.
Please test and let me know how it goes. If still failing tell exactly what is the process (and sample images would be good if I already don't have them).
LibreELEC-imx6.arm-8.0.1.img.gz
Before Linux kernel issued Oops. But now OOM (Out Of Memory) can happen and Kodi restarts.
In case this image works it would be good to check if all video files are still played.