pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tjard Kopka <Tjard.Ko...@dvag.com>
Subject Antwort: Re: Problems with ScratchFileBuffer and Finalizer: OutOfMemory
Date Thu, 17 Nov 2016 09:47:28 GMT
Hello,

all the Finalizer-Instances in the heap dump have a reference to 
ScratchFileBuffer-Instances:

class java.lang.ref.Finalizer @ 0xc0005768 System Class 
|- java.lang.ref.Finalizer @ 0xed44ed10 
|  |- java.lang.ref.Finalizer @ 0xed43c9b0 
|  |- org.apache.pdfbox.io.ScratchFileBuffer @ 0xed44ecd0

where as example
        java.lang.ref.Finalizer @ 0xed44ed10 
has as referent;
        org.apache.pdfbox.io.ScratchFileBuffer @ 0xed44ecd0


I think the reason herefore is the overriden finalize method in 
ScratchFielBuffer:

    @Override
    protected void finalize() throws Throwable
    {
        try
        {
            if ((pageHandler != null) && LOG.isDebugEnabled())
            {
                LOG.debug("ScratchFileBuffer not closed!");
            }
            close();
        }
        finally
        {
            super.finalize();
        }
    }


I found this as a possible goog explanation for our out of memory crashes:
Objects which override this method (finalize) need to called by a 
background thread call finalizer, and they can't be cleaned up until this 
happens. If these tasks are short and you don't discard many of these it 
all works well. However if you are creating lots of these objects and/or 
their finalizers take a long time, the queue of objects to be finalized 
builds up. It is possible for this queue to use up all the memory.

Thanks
Tjard




[excerpt from memory analysis snipped]
> 
> Nevertheless, do you have a quick fix or workaround for us?

No... from what I see, the 70,1% are not pdfbox but java itself?!

Consider updating to the current 1.8 JDK version... if the problem 
doesn't go away, try reproducing it with files you can share.










---------------------------------------------------------------------
Deutsche Vermögensberatung Aktiengesellschaft DVAG
Münchener Straße 1
60329 Frankfurt am Main
Vorstandsvorsitzender: Andreas Pohl
Mitglieder des Vorstandes: Dr. h.c. /HLU Udo Corts, Hans-Theo Franken, Christian Glanz, 
Lars Knackstedt, Dr. Helge Lach, Robert Peil, Dr. Dirk Reiffenrath
Aufsichtsratsvorsitzender: Friedrich Bohl
Sitz der Gesellschaft: Frankfurt am Main
Handelsregister Frankfurt HRB 15511
USt-Ident.-Nr.: DE 114 139 839
Erlaubnis- und Aufsichtsbehörde nach § 34c GewO: Stadt Frankfurt am Main, Ordnungsamt, Kleyerstraße
86, 60326 Frankfurt am Main 
Erlaubnis- und Aufsichtsbehörde nach § 34f GewO: IHK Frankfurt am Main, Börsenplatz 4,
60313 Frankfurt am Main 
Gemeinsame Registerstelle für § 34d GewO und § 34f GewO: 
Deutscher Industrie- und Handelskammertag (DIHK) e.V. 
Breite Straße 29, 10178 Berlin, Telefon 0180 600585-0 
(20 Cent/Anruf aus dem deutschen Festnetz, höchstens 60 Cent/Anruf aus Mobilfunknetzen) 
www.vermittlerregister.info oder www.vermittlerregister.org 
Registernummer nach § 34d GewO: D-LYYB-BSPX5-17 
Registernummer nach § 34f GewO: D-F-125-93J4-60 
--------------------------------------------------------------------- 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message