Originally Posted by wiffel
While implementing this, I did add the LUA collectgarbage a couple of times to make sure that images are garbage collected. I noticed that I did have a lot of crashes while generating the PDF. This makes me think that the PDF structure (used by outpdf:addPage(image)) does not keep a reference to the images that have been added. That could account for the 'random' crashes. Just to be sure, I did add a little list that keeps a reference to the images until the PDF has been created. That way they can not be garbage collected by LUA. That seemed to fix the crashes for me.
Actually, I haven't tested the pdf output functionality of paper crop intensively, because my ebook device doesn't support PDF files. I downloaded your config.lua and it seems to work very well for me.
By the way, if you want, I can make you (or anybody who whats) as a member of the googlecode project page, so that you can update the source codes/binary directly, or upload your versions of papercrop binary there so that people can choose which version to use. (whenever I update a version, it seems that a new bug is always introduced..)
P.S. As far as I understand the libharu library and my PDFWriter class, outpdf:addPage doesn't keep a pointer to the image, and you can discard the image as soon as you call the addPage funtion. But I cannot figure out why such kind of problem happened.