View Issue Details

IDProjectCategoryView StatusLast Update
0002228Ham Radio DeluxeBugpublic2017-09-18 00:08
ReporterK7ZCZAssigned ToK7ZCZ 
Status closedResolutionfixed 
PlatformIntel i7-5960XOSWindows 10 Professional x64OS Version1703
Product Version6.4.0.780 
Target VersionFixed in Version6.4.0.787 
Summary0002228: Logbook: leaks memory from global heap for each logfile message sent from HRDInterface001
This changeset:

altered the logging message such that the string to be logged was allocated on the global heap, and passed in wParam of the message. A compensating change was made in the logfile implementation of the Digital Master application so that the status quo of sending the message with a CRT-allocated string passed in lParam was still handled, but the wParam mechansm was also handled and correctly freed.

No such compensating change was made in the Logbook application. As such, each and every message so sent to the logbook was leaked -- left on the global heap. This also had the side-effect of inserting an empty line into the logfile window. When busy, the logfile window is noisy with such messagaes, all blank lines.
Steps To Reproduce
1) Fire up the logbook
2) turn on "Debug" and "Timing" logs in the logfile view (reachable with the "Logfile" command in the "View" menu)
3) open your favorite database
4) Use the "Add" button in the logbook database view to add a QSO
5) save it. Close the ALE.
6) Activate the logfile view. Note there are a couple of dozen empty lines. Any place where there is more than one empty line in a row is most likely a memory leak.

Additional InformationThis issue demonstrates several problems:

1) Terrible code-review practices. A code review by an experienced developer familiar with the proeject has a chance of pointing out that the message is processed in two different places, and that handling code needs to be repaired in both places.

2) A lack of understanding of what causes a memory leak -- and what fixes it. The original checkin claimed to fix a memory leak. Really, it moved the memory leak from the CRT heap (where it is detected and traced at shutdown) to the global heap (where it isn't detected or traced; and therefore assumed to be fixed).

3) A poor understanding of the Windows architecture. Small allocations aren't good candidates for the global heap for at least a couple of reasons. Locked memory regions have several counter-indications, as well.

TagsNo tags attached.
TestingNot Started



2017-08-22 21:46

administrator   ~0004075

fixed with this changeset:


2017-09-12 03:30

viewer   ~0004171

While investigating this issue using
1) Fire up the logbook
2) turn on "Debug" and "Timing" logs in the logfile view (reachable with the "Logfile" command in the "View" menu)
3) open your favorite database
4) Use the "Add" button in the logbook database view to add a QSO
When I reach 4) the ALE stops responding and Logbook has to close. This is repeatable.
Sorry, no minidump seems to be created.


2017-09-12 03:42

viewer   ~0004172

Actually two minidumps have just been created but I do not know which relates to the above issue.
Both attached. HTH

HRDLogbook.dmp (179,031 bytes)


2017-09-12 03:43

viewer   ~0004173

2nd dump. Sorry it is large


2017-09-12 03:44

viewer   ~0004174

It did not upload.


2017-09-14 17:43

viewer   ~0004188

I justv tested this again and got the same result as before i.e the Logbook stopped responding.
I invoked Task Manager and got the Logbook.dmp but it is still 143Mb zipped.


2017-09-18 00:08

administrator   ~0004208

Closed as part of the release.

Issue History

Date Modified Username Field Change
2017-08-22 18:42 K7ZCZ New Issue
2017-08-22 21:46 K7ZCZ Assigned To => K7ZCZ
2017-08-22 21:46 K7ZCZ Status new => resolved
2017-08-22 21:46 K7ZCZ Resolution open => fixed
2017-08-22 21:46 K7ZCZ Note Added: 0004075
2017-09-01 16:41 K7ZCZ Fixed in Version =>
2017-09-07 18:18 K7ZCZ Fixed in Version =>
2017-09-11 21:32 K7ZCZ Fixed in Version =>
2017-09-12 03:30 g3ucq Note Added: 0004171
2017-09-12 03:42 g3ucq File Added: HRDLogbook.dmp
2017-09-12 03:42 g3ucq Note Added: 0004172
2017-09-12 03:43 g3ucq Note Added: 0004173
2017-09-12 03:44 g3ucq Note Added: 0004174
2017-09-14 17:43 g3ucq Note Added: 0004188
2017-09-14 19:23 K7ZCZ Fixed in Version =>
2017-09-18 00:06 WA9PIE Project 3 - Current Dev List => Ham Radio Deluxe
2017-09-18 00:08 WA9PIE Note Added: 0004208
2017-09-18 00:08 WA9PIE Status resolved => closed