mattn / go-oci8

Oracle driver for Go using database/sql
https://mattn.kaoriya.net/
MIT License
630 stars 212 forks source link

memory leak #404

Closed sfqsfq closed 3 years ago

sfqsfq commented 4 years ago

When I set dataSourceName with a wrong username or a wrongpassword. This demo code will lead a memory leak.

func main() {
    db, err := sqlx.Open("oci8", "xxx/xxx@127.0.0.1:1521/orcl")
    if err != nil {
        panic(err)
    }
    for {
        var i int
        err = db.Get(&i, "select 1 from dual")
        if err != nil {
            log.Println(err)
        }
    }
}

It seems that func (oci8Driver *OCI8DriverStruct) Open(dsnString string) (driver.Conn, error) doesn't free the resources when C.OCISessionBegin( ... return -1.

MichaelS11 commented 4 years ago

What version are you on? There was memory leaks in the past, but I think it was fixed.

sfqsfq commented 3 years ago

What version are you on? There was memory leaks in the past, but I think it was fixed.

It was fixed. I use the old library.