skip2/go-qrcode

Memory Leak?

link-duan opened this issue · 3 comments

Is there a memory leak problem with this library?
There is a web api with my application for generating QRCode.
I found that the memory footprint would be very high after many requests to this api and do not come down.

go version go1.11.2 windows/amd64

My Code like this:

func UserAuthQRCode(w http.ResponseWriter, r *http.Request) {
	defer r.Body.Close()
	w.Header().Set("Content-Type", "image/png")
	authUrl := "..."
	qrCodeImg, err := qrcode.Encode(
		authUrl,
		qrcode.Medium,
		256)
	if err != nil {
		http.Error(w, "Internal Error", http.StatusInternalServerError)
		return
	}
	_, _ = w.Write(qrCodeImg)
	return
}

Hey @link-duan, did you found any solution?

skip2 commented

I'll check to see if this is a problem. How many QR codes are you generating at a time?

It seems that this issue still exists. I can see memory footprint raising with each qr code generated.