- 
                Notifications
    
You must be signed in to change notification settings  - Fork 23
 
Open
Description
I have a problem where i push hundreds of .fodt => .pdf files through this loop and get a ~.5MiB extra memory usage per file and it is not feed (so not gc).
Moving office into the loop explodes the memory usage over time so i'm out of ides. Am i doing something wrong here or is something related to the document not freed on doc.Close()?
type Request struct {
	SourceFile string
	TargetFile string
	TargetExt  string
	Filter     string
	done       chan bool
}
var request chan *Request
func office() {
	office, err := libreofficekit.NewOffice("/usr/lib/libreoffice/program")
	if err != nil {
		log.Fatal(err)
	}
	defer office.Close()
	for {
		select {
		case r := <-request:
			doc, err := office.LoadDocument(r.SourceFile)
			if err != nil {
				office.GetError()
				r.done <- true
				continue
			}
			defer doc.close()
			if err := doc.SaveAs(r.TargetFile, r.TargetExt, r.Filter); err != nil {
				r.done <- true
				continue
			}
			r.done <- true
		}
	}
}Metadata
Metadata
Assignees
Labels
No labels