HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Troubleshooting › Render crashes and heap space fills
- This topic has 2 replies, 2 voices, and was last updated Oct 01, 2012
19:27:28 byPD4ML.
-
AuthorPosts
-
September 17, 2012 at 22:08#26779
When an certain snippet of HTML exists in a document, it will make the renderer enter some kind of death spiral where it will fill up the heap until the machine stops responding.
The snippet seems to be
<SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>In context of a very simple example:
<table> <tr> <td> TEXT <!--<SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>--> MORE TEXT <SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN> FINAL TEXT </td> </tr> </table>
Here’s a histogram of my heap after trying to render this HTML:
num #instances #bytes class name <hr class="bbcode_rule" /> 1: 12253005 784192320 org.zefer.html.doc.view.b 2: 517 55412344 [Ljava.lang.Object; 3: 26309 3785624 <constMethodKlass> 4: 26309 3590760 <methodKlass> 5: 2671 2474760 [B 6: 1786 2400848 <constantPoolKlass> 7: 1786 1494536 <instanceKlassKlass> 8: 1504 1396576 <constantPoolCacheKlass> 9: 18028 1279584 [C 10: 8536 603344 [I 11: 18388 588416 java.lang.String 12: 12400 396800 java.util.HashMap$Entry 13: 457 321504 <methodDataKlass> 14: 1966 242192 java.lang.Class 15: 2781 204224 [S 16: 2765 173064 [[I 17: 6991 111856 java.lang.Integer 18: 304 108560 [Ljava.util.HashMap$Entry; 19: 163 95192 <objArrayKlassKlass> 20: 1761 56352 java.util.concurrent.ConcurrentHashMap$HashEntry
And the following is a very short Java program to demonstrate the issue:
String html = "<table><tr><td>TEXT<SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>MORE TEXT<SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>FINAL TEXT</td></tr></table>"; StringReader sr = new StringReader(html); OutputStream os = new ByteArrayOutputStream(); PD4ML pd4ml = new PD4ML(); pd4ml.enableDebugInfo(); pd4ml.useTTF( "java:", true ); pd4ml.setHtmlWidth(1050); pd4ml.enableSmartTableBreaks(true); try { pd4ml.render(sr, os); } catch (Exception e) { } sop(((ByteArrayOutputStream)os).toByteArray());September 18, 2012 at 14:14#29116We reproduced the problem and work on it.
October 1, 2012 at 19:27#29117The problem is fixed in the development build. To be released in 2-3 days.
-
AuthorPosts
The forum ‘Troubleshooting’ is closed to new topics and replies.
