Forum Bugs

Prince 12.5 - Fatal Error in gc: Too many heap sections

This error is occurring both when using prince XML programmatically within our application and when I attempted the same conversion using the Standalone Windows 10 32-bit application.

I'm converting a single, very large html file (58mb). The conversion fails and a popup shows:

Fatal Error in gc:

Too many heap sections.

Unfortunately I cannot send the document as it is a private document provided under NDA, but I can attach logs if you provide me with instructions to do so.


UPDATE: I was able to reproduce this on 14.2 also. attached screenshot.

  1. prince-error.jpg761.0 kB
Can you try the 64-bit build of Prince?
Hi mikeday,

I can confirm using the 64-bit version worked. You think it has something to do with the GC data structure's max size on 32-bit? This is an issue, as we have to ship 32-bit to our customers as some are on old workplace desktops.

Ideally we could reduce the memory usage, although if the document is big enough then it will always run out of memory eventually.

If you cannot send us the document for testing as is, perhaps you could redact it? I attach a script which you can run like this:
prince --script redact.js doc.html > new.html

The resulting new.html will have all the text replaced with "xxxx" but the overall document structure remains the same, so it should have similar memory usage and trigger the same behaviour.

If this looks acceptable you can send it to me ( and we can run some tests.
  1. redact.js0.6 kB
I don't think a redacted version could even be sent. We'd have to reach out to the client for approval, which I doubt we'll receive. I ran some tests to figure out just how large of PDFs we're causing this. I'd see GC filling up at ~8000 pages.

For now, we're imposing this limitation on ourselves. I'm wondering if there is an easy way for us to tell how many pages an HTML document would generate without actually generating them. I've seen solutions on this forum for getting page number, but they all involve actually generating the PDFs.


Edited by citeright-rob

Page number requires typesetting the PDF, but perhaps there is some other proxy for document size you could use, like number of sections, paragraphs, or table rows as appropriate?
Hmm... I don't think those would be good indicators based solely on their variable size, but I've got other ideas.

Please let me know if plan to handle this error in a more graceful way than the popup, then we could catch it in our program.