Open echoiron opened 5 years ago
This may be related to #110. Do you include high-resolution images in your documents?
thanks reply. document is in plain text.
memory not released
Is your application a long-running service? If so, does the memory usage continue to get larger or does it plateau at some level?
yes,our server is a long-running and memory usage will continue to grow
pdf api code
pprof monitor
pprof traces
Type: inuse_space
Time: Sep 16, 2019 at 9:52am (CST)
-----------+-------------------------------------------------------
bytes: 72kB
0 bytes.makeSlice
bytes.(*Buffer).grow
bytes.(*Buffer).Write
encoding/json.intEncoder
encoding/json.arrayEncoder.encode
encoding/json.sliceEncoder.encode
encoding/json.structEncoder.encode
encoding/json.ptrEncoder.encode
encoding/json.(*encodeState).reflectValue
encoding/json.(*encodeState).marshal
encoding/json.Marshal
github.com/jung-kurt/gofpdf.generateFontID
github.com/jung-kurt/gofpdf.(*Fpdf).addFont
github.com/jung-kurt/gofpdf.(*Fpdf).AddUTF8Font
beegopdf/controllers.(*PdfGeneratorController).HandlerPdfGenerator
reflect.Value.call
reflect.Value.Call
github.com/astaxie/beego.(*ControllerRegister).ServeHTTP
net/http.serverHandler.ServeHTTP
net/http.(*conn).serve
-----------+-------------------------------------------------------
...
...
-----------+-------------------------------------------------------
bytes: 2.26MB
0 github.com/jung-kurt/gofpdf.(*utf8FontFile).generateSCCSDictionaries
github.com/jung-kurt/gofpdf.(*utf8FontFile).parseTables
github.com/jung-kurt/gofpdf.(*utf8FontFile).parseFile
github.com/jung-kurt/gofpdf.(*Fpdf).addFont
github.com/jung-kurt/gofpdf.(*Fpdf).AddUTF8Font
beegopdf/controllers.(*PdfGeneratorController).HandlerPdfGenerator
reflect.Value.call
reflect.Value.Call
github.com/astaxie/beego.(*ControllerRegister).ServeHTTP
net/http.serverHandler.ServeHTTP
net/http.(*conn).serve
-----------+-------------------------------------------------------
bytes: 1.20MB
0 github.com/jung-kurt/gofpdf.(*utf8FontFile).generateSCCSDictionaries
github.com/jung-kurt/gofpdf.(*utf8FontFile).parseTables
github.com/jung-kurt/gofpdf.(*utf8FontFile).parseFile
github.com/jung-kurt/gofpdf.(*Fpdf).addFont
github.com/jung-kurt/gofpdf.(*Fpdf).AddUTF8Font
beegopdf/controllers.(*PdfGeneratorController).HandlerPdfGenerator
reflect.Value.call
reflect.Value.Call
github.com/astaxie/beego.(*ControllerRegister).ServeHTTP
net/http.serverHandler.ServeHTTP
net/http.(*conn).serve
-----------+-------------------------------------------------------
...
-----------+-------------------------------------------------------
bytes: 20.77MB
20.77MB bytes.makeSlice
bytes.(*Buffer).grow
bytes.(*Buffer).Grow
io/ioutil.readAll
io/ioutil.ReadFile
github.com/jung-kurt/gofpdf.(*Fpdf).addFont
github.com/jung-kurt/gofpdf.(*Fpdf).AddUTF8Font
beegopdf/controllers.(*PdfGeneratorController).HandlerPdfGenerator
reflect.Value.call
reflect.Value.Call
github.com/astaxie/beego.(*ControllerRegister).ServeHTTP
net/http.serverHandler.ServeHTTP
net/http.(*conn).serve
-----------+-------------------------------------------------------
...
-----------+-------------------------------------------------------
bytes: 11.16MB
11.16MB bytes.makeSlice
bytes.(*Buffer).grow
bytes.(*Buffer).Grow
io/ioutil.readAll
io/ioutil.ReadFile
github.com/jung-kurt/gofpdf.(*Fpdf).addFont
github.com/jung-kurt/gofpdf.(*Fpdf).AddUTF8Font
beegopdf/controllers.(*PdfGeneratorController).HandlerPdfGenerator
reflect.Value.call
reflect.Value.Call
github.com/astaxie/beego.(*ControllerRegister).ServeHTTP
net/http.serverHandler.ServeHTTP
net/http.(*conn).serve
-----------+-------------------------------------------------------
...
-----------+-------------------------------------------------------
bytes: 9.30MB
9.30MB bytes.makeSlice
bytes.(*Buffer).grow
bytes.(*Buffer).Grow
io/ioutil.readAll
io/ioutil.ReadFile
github.com/jung-kurt/gofpdf.(*Fpdf).addFont
github.com/jung-kurt/gofpdf.(*Fpdf).AddUTF8Font
beegopdf/controllers.(*PdfGeneratorController).HandlerPdfGenerator
reflect.Value.call
reflect.Value.Call
github.com/astaxie/beego.(*ControllerRegister).ServeHTTP
net/http.serverHandler.ServeHTTP
net/http.(*conn).serve
-----------+-------------------------------------------------------
...
-----------+-------------------------------------------------------
bytes: 64B
0 syscall.UTF16ToString
internal/syscall/windows/registry.Key.ReadSubKeyNames
mime.initMimeWindows
mime.initMime
sync.(*Once).Do
mime.AddExtensionType
github.com/astaxie/beego.registerMime
github.com/astaxie/beego.initBeforeHTTPRun
github.com/astaxie/beego.Run
main.main
runtime.main
-----------+-------------------------------------------------------
hello author , could you add close methods of「AddUTF8Font」? although golang gc automatically reclaims memory, but time is slow.
Thank you, @dajiugo, for tracking this problem down.
could you add close methods of「AddUTF8Font」?
Yes, I will do this shortly.
+1
I've opened a similar issue to gopdf: https://github.com/signintech/gopdf/issues/116 But later realized that the problem is not in leaks, but in the work of the application process.
Any news? 😢
Any news?
Not yet -- hopefully soon.
Hello, our service uses your gopdf framework and has a high memory footprint. feedback