If given a large archive comical will use insane amounts of memory generating thumbnails; I have had it use over three Gigabytes of virtual memory! (ie it ran out!!) The problem is that it loads the uncompressed original image into memory but doesn't discard that image once it's created the thumbnail. It only discards the original image at the same time that it's discarding real resized images after you move the current image on one.
The attached patch simply adds this discard line.
Current memory usage appers to be around 50MB to 80MB with about 32k added per image in the archive (for thumbnails).