Memory leak in the C-function EnumWindows ()

Moderator: Rathinagiri

Post Reply
User avatar
gfilatov
Posts: 1087
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Memory leak in the C-function EnumWindows ()

Post by gfilatov »

Hi Claudio,

There is a confirmed memory leak in the callback of the function EnumWindows () :?

This line is wrong

Code: Select all

...
   hb_arrayAddForward (pArray, hb_itemPutNLL (NULL, (LONG_PTR) hWnd));
The simple fix of this problem is below

Code: Select all

  PHB_ITEM pHWnd = hb_itemPutNLL (NULL, (LONG_PTR) hWnd);

   hb_arrayAddForward (pArray, pHWnd);

   hb_itemRelease( pHWnd );
... 
Hope that helps :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Memory leak in the C-function EnumWindows ()

Post by Rathinagiri »

Thanks for pointing out Grigory.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Memory leak in the C-function EnumWindows ()

Post by srvet_claudio »

Many thanks Grigory.
I will fix.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Memory leak in the C-function EnumWindows ()

Post by srvet_claudio »

srvet_claudio wrote:Many thanks Grigory.
I will fix.
Done!
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
serge_girard
Posts: 3178
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Memory leak in the C-function EnumWindows ()

Post by serge_girard »

Thanks Claudio!

Serge
There's nothing you can do that can't be done...
Post Reply