[ 
https://issues.apache.org/jira/browse/PDFBOX-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16370452#comment-16370452
 ] 

Tilman Hausherr commented on PDFBOX-4080:
-----------------------------------------

I didn't understand your comment, slept over it twice, then tried to use the 
method, and found out that we need 4096 per stream, and now it all makes sense. 
So this code works for the highlight handler:
{code}
ScratchFile scratchFile = new 
ScratchFile(MemoryUsageSetting.setupMainMemoryOnly(4096 * 2));
PDFormXObject frm1 = new PDFormXObject(new COSStream(scratchFile));
PDFormXObject frm2 = new PDFormXObject(new COSStream(scratchFile));
{code}
The code no longer works when using 1 byte less. So if we restrict the memory, 
we need 4096 per stream, probably because each stream will use one "page" of 
the scratch file.
Please add some comment to the new method so that we don't get support calls on 
this one.

> Improve memory consumption of PDAbstractAppearanceHandler
> ---------------------------------------------------------
>
>                 Key: PDFBOX-4080
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4080
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 3.0.0 PDFBox
>            Reporter: Maruan Sahyoun
>            Assignee: Maruan Sahyoun
>            Priority: Major
>              Labels: Annotations
>
> PDAbstractAppearanceHandler calls new COSStream(), this has a huge memory 
> footprint (PDFBOX-3868 and PDFBOX-3852). We'd need to find a way to pass the 
> document, or the document scratch file, or there will be trouble for files 
> with many annotations, e.g. a long scientific document with many footnotes.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to