Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-05

Memory leak in dbgrids?

4 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

Hello,

I'm migrating some programs from lazarus 0.9.30 to lazarus 1.0.8 (well, actually updating and recompiling, there's no need to migrate anything). Heaptrc is showing some memory leaks in dbgrid, though it doesn't pinpoint the line exactly.
I think the leak is due to the change of type from TBookarkStr to TBookmark, and dbgrids calls GetBookmark but never calls FreeBookmark (it either discards the bookmark in local functions or assigns nil to it). I'll try calling FreeBookmark and see if the leak goes away.

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es Tel. +34 935883004 Fax +34 935883007

Reply by email

Luca Olivetti
to Luca Olivetti

Al 10/05/13 09:13, En/na Luca Olivetti ha escrit:

Show quoted text 10 lines
Hello, I'm migrating some programs from lazarus 0.9.30 to lazarus 1.0.8 (well, actually updating and recompiling, there's no need to migrate anything). Heaptrc is showing some memory leaks in dbgrid, though it doesn't pinpoint the line exactly. I think the leak is due to the change of type from TBookarkStr to TBookmark, and dbgrids calls GetBookmark but never calls FreeBookmark (it either discards the bookmark in local functions or assigns nil to it). I'll try calling FreeBookmark and see if the leak goes away.

Mmh, actually it does, because FKeyBoomark is assigned nil only after clearing the list of selected records.
Maybe the problem comes from the version of zeos in case it returns a different pointer for the same record?

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es Tel. +34 935883004 Fax +34 935883007

Reply by email

Luca Olivetti
to Luca Olivetti

Al 10/05/13 09:36, En/na Luca Olivetti ha escrit:

Show quoted text 16 lines
Al 10/05/13 09:13, En/na Luca Olivetti ha escrit: > Hello, > > I'm migrating some programs from lazarus 0.9.30 to lazarus 1.0.8 (well, > actually updating and recompiling, there's no need to migrate anything). > Heaptrc is showing some memory leaks in dbgrid, though it doesn't > pinpoint the line exactly. > I think the leak is due to the change of type from TBookarkStr to > TBookmark, and dbgrids calls GetBookmark but never calls FreeBookmark > (it either discards the bookmark in local functions or assigns nil to it). > I'll try calling FreeBookmark and see if the leak goes away. Mmh, actually it does, because FKeyBoomark is assigned nil only after clearing the list of selected records. Maybe the problem comes from the version of zeos in case it returns a different pointer for the same record?

Now I made a test project using SQLdb instead of zeos and the leak is still there.
It happens with multiselect, each new selection increases the non-freed block count.

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es Tel. +34 935883004 Fax +34 935883007

Reply by email