Open robbrockbank opened 1 year ago
No memory leaks that I'm aware of. I'm interested in taking a look if you have a shareable example / case where you are experiencing a leak.
And/or try something similar to this (replacing embed paths) and let me know if you still observe a leak.
package main
import (
_ "embed"
"github.com/wamuir/go-xslt"
)
//go:embed path/to/your/stylesheet.xsl
var style []byte
//go:embed path/to/your/document.xml
var doc []byte
func main() {
for {
func() {
xs, err := xslt.NewStylesheet(style)
if err != nil {
panic(err)
}
defer xs.Close()
_, err = xs.Transform(doc)
if err != nil {
panic(err)
}
}()
}
}
Hi. I tried this library out to do some transforms and seem to be hitting a large memory leak.
I'm running frequent transforms and memory seems to be increasing each transform in an unbounded way. I've tried reusing the same stylesheet and I've also tried closing it and reloading the stylesheet to perform each transform. In both cases I'm seeing memory climb without limit.
I've run pprof and nothing is showing up in the golang structs - so not leaking anything there. I also did a sanity check switching out this library and exec-ing xsltproc to do the transform instead (everything else remaining the same) and memory footprint remains constant.
Wondering if you had seen this, or had any thoughts as to where the leak may occur. I'm going to keep digging - but if you have any thoughts or pointers as to where/how to investigate then that would be greatly appreciated.