skip2 / go-qrcode

:sparkles: QR Code encoder (Go)
http://go-qrcode.appspot.com
MIT License
2.64k stars 338 forks source link

Memory Leak? #21

Closed link-duan closed 5 years ago

link-duan commented 5 years ago

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
}
sthales commented 4 years ago

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

skip2 commented 4 years ago

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

DVSoftware commented 2 years ago

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