Repository: nvaccess/nvda

Issue:
Lots of garbage collection messages when loading Gmail in Firefox
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:

Saw this twice after restarting Firefox and loading Gmail. Careful, long log excerpt upcoming:

```
ERROR - garbageHandler.notifyObjectDeletion (06:50:20.867) - MainThread (25656):
Garbage collector has found one or more unreachable objects. See further warnings for specific objects.
Stack trace:
  File "nvda.pyw", line 215, in <module>
  File "core.pyc", line 550, in main
  File "wx\core.pyc", line 2134, in MainLoop
  File "gui\__init__.pyc", line 1050, in Notify
  File "core.pyc", line 520, in run
  File "queueHandler.pyc", line 88, in pumpAll
  File "queueHandler.pyc", line 55, in flushQueue
  File "eventHandler.pyc", line 65, in _queueEventCallback
  File "eventHandler.pyc", line 217, in executeEvent
  File "eventHandler.pyc", line 96, in __init__
  File "eventHandler.pyc", line 105, in next
  File "browseMode.pyc", line 1563, in event_gainFocus
  File "speech\__init__.pyc", line 1087, in speakTextInfo
  File "speech\types.pyc", line 42, in __iter__
  File "speech\__init__.pyc", line 1127, in getTextInfoSpeech
  File "virtualBuffers\__init__.pyc", line 283, in getTextWithFields
  File "virtualBuffers\__init__.pyc", line 268, in _getFieldsInRange
  File "XMLFormatting.pyc", line 67, in parse
  File "XMLFormatting.pyc", line 45, in _EndElementHandler
  File "comtypesMonkeyPatches.pyc", line 104, in newCpbDel
  File "garbageHandler.pyc", line 63, in notifyObjectDeletion
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible) ptr=0xd029e64 at 4345620>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.WindowRoot object at 0x07D709F0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <NVDAObjects.window.Desktop object at 0x0CA4E350>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xccc23a4 at c9e5c10>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <NVDAObjects.Dynamic_WebDialogDocumentMozillaIAccessible object at 0x0CA4E890>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd029e1c at 3ee5120>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd02a32c at 3fb0850>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xccc23a4 at 4345ee0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <NVDAObjects.Dynamic_WebDialogDocumentMozillaIAccessible object at 0x0CA4EEF0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd029e1c at 43459e0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd02a32c at 4345a30>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xce5c04c at 14e9800>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0CA4EB50>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xce5d09c at 43453f0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xce5d204 at 14e9d50>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <'appModuleHandler' (appName 'firefox', process ID 17828) at address c95f430>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.898) - MainThread (25656):
Deleting unreachable object <virtualBuffers.gecko_ia2.Gecko_ia2 object at 0x0431A270>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <NVDAObjects.Dynamic_DocumentMozillaIAccessible object at 0x0561A5D0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xcf2bdd4 at 14e9490>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xcf2c20c at 14e9e90>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xcf2bbdc at 14e93f0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0561A210>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd02036c at 14e9f30>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd020a2c at 14e9c10>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0155FF90>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd02036c at 43a59e0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd020a2c at 43a5e90>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <NVDAObjects.Dynamic_DialogMozillaIAccessible object at 0x0155F4D0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd020fcc at 43a58f0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd02144c at 43a5170>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0431AFF0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd021494 at 43a5300>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.914) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd020eac at 43a5ad0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0431AB70>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xce5b674 at 43a5c60>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xce5bc14 at 43a5530>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xce5c0dc at 43a5490>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <NVDAObjects.Dynamic_RowWithFakeNavigationMozillaIAccessible object at 0x0CA4E330>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd025e44 at 14a23a0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd026234 at c9e5710>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd0260cc at c9e5350>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0CA4E210>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd026504 at 4345b70>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd026e94 at 4345670>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd0265dc at 4345990>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0155F8B0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd026624 at 4345cb0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd026a5c at 4345440>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleTable2) ptr=0xd0266b4 at 4345850>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd026dbc at 4345c60>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0431ADB0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd026d2c at 4345c10>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd026b34 at 14e90d0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd026c54 at 4345350>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0C7BFD70>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd027434 at 4345b20>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd02735c at 43452b0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd0273ec at 4345f30>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.917) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0C7BF210>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd02774c at 4345030>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd02762c at 4345d50>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd02711c at 43458f0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0BA5F2B0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd028004 at 4345490>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd027d34 at 4345530>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd027e9c at 4345800>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0BA5FBD0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd027944 at 43454e0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd027f2c at 4345260>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xd027824 at 4345ad0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <NVDAObjects.Dynamic_DocumentMozillaIAccessible object at 0x0BA5FB50>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xcf2bdd4 at 4345170>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xcf2c20c at 4345210>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xcf2bbdc at 43451c0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0C7BF5B0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd02036c at 4345d00>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd020a2c at 4345a80>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.922) - MainThread (25656):
Deleting unreachable object <NVDAObjects.Dynamic_DialogMozillaIAccessible object at 0x04323110>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd020fcc at 563c1c0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd02144c at 43a5030>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x0BA5F750>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xd021494 at 563cd50>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xd020eac at 563c620>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x043A0C10>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xce5b674 at 563c580>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xce5bc14 at 563c350>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.927) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xce5c0dc at 563c7b0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x04D35350>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible2) ptr=0xce5b674 at 14a2530>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleAction) ptr=0xce5bc14 at 14fe800>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessibleText) ptr=0xce5c0dc at 14a2490>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.WindowRoot object at 0x0CA13230>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible) ptr=0xd01fe14 at 43a55d0>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <NVDAObjects.IAccessible.WindowRoot object at 0x0CA1EC90>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <POINTER(IAccessible) ptr=0xce5b59c at 43a5210>
WARNING - garbageHandler.notifyObjectDeletion (06:50:20.932) - MainThread (25656):
Deleting unreachable object <NVDAObjects.window.Desktop object at 0x0BC95970>
ERROR - garbageHandler._collectionCallback (06:50:20.932) - MainThread (25656):
Found at least 96 unreachable objects in run
```

### Actual behavior:

See above.

### Expected behavior:

No such errors.

### System configuration
#### NVDA installed/portable/running from source:

Installed.

#### NVDA version:

version alpha-20793,9a4074bc

#### Windows version:

10 20H2.

#### Name and version of other software in use when reproducing the issue:

Firefox Nightly 82.

#### Other information about your system:

Focus 40 Blue 5th Generation display connected.

### Other questions
#### Does the issue still occur after restarting your computer?

Intermittent, don't know, but probably yes, at some point.

#### Have you tried any other versions of NVDA? If so, please report their behaviors.

No, since the logging of garbage collected reference cycles has only been introduced recently.

#### If addons are disabled, is your problem still occuring?

U<nknown.

#### Did you try to run the COM registry fixing tool in NVDA menu / tools?

No.

CC @michaelDCurran @feerrenrut 


Discussion:
These messages were introduced with #11499 with the intention of finding problematic reference cycles
Yes, that's why I reported it straight away, since I thought you might be interested in this particular error.
More garbage collection log entries when loading web sites into tabs in Firefox:

```
ERROR - garbageHandler.notifyObjectDeletion (12:27:24.266) - MainThread (23188):
Garbage collector has found one or more unreachable objects. See further warnings for specific objects.
Stack trace:
  File "nvda.pyw", line 215, in <module>
  File "core.pyc", line 550, in main
  File "wx\core.pyc", line 2134, in MainLoop
  File "gui\__init__.pyc", line 1050, in Notify
  File "core.pyc", line 520, in run
  File "queueHandler.pyc", line 88, in pumpAll
  File "queueHandler.pyc", line 55, in flushQueue
  File "eventHandler.pyc", line 65, in _queueEventCallback
  File "eventHandler.pyc", line 217, in executeEvent
  File "eventHandler.pyc", line 96, in __init__
  File "eventHandler.pyc", line 105, in next
  File "browseMode.pyc", line 1563, in event_gainFocus
  File "speech\__init__.pyc", line 1087, in speakTextInfo
  File "speech\types.pyc", line 42, in __iter__
  File "speech\__init__.pyc", line 1127, in getTextInfoSpeech
  File "virtualBuffers\__init__.pyc", line 283, in getTextWithFields
  File "virtualBuffers\__init__.pyc", line 273, in _getFieldsInRange
  File "virtualBuffers\gecko_ia2.pyc", line 67, in _normalizeControlField
  File "garbageHandler.pyc", line 23, in __del__
  File "garbageHandler.pyc", line 63, in notifyObjectDeletion
  File "logging\__init__.pyc", line 1407, in error
  File "logHandler.pyc", line 160, in _log
  File "logging\__init__.pyc", line 1514, in _log
  File "logging\__init__.pyc", line 1524, in handle
  File "logging\__init__.pyc", line 1586, in callHandlers
  File "logHandler.pyc", line 279, in handle
  File "nvwave.pyc", line 567, in playWaveFile
  File "nvwave.pyc", line 490, in __del__
  File "garbageHandler.pyc", line 23, in __del__
  File "garbageHandler.pyc", line 63, in notifyObjectDeletion
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.284) - MainThread (23188):
Deleting unreachable object <nvwave.WavePlayer object at 0x011E63D0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.284) - MainThread (23188):
Deleting unreachable object <nvwave.WavePlayer object at 0x0554CA50>
ERROR - garbageHandler.notifyObjectDeletion (12:27:24.244) - MainThread (23188):
Garbage collector has found one or more unreachable objects. See further warnings for specific objects.
Stack trace:
  File "nvda.pyw", line 215, in <module>
  File "core.pyc", line 550, in main
  File "wx\core.pyc", line 2134, in MainLoop
  File "gui\__init__.pyc", line 1050, in Notify
  File "core.pyc", line 520, in run
  File "queueHandler.pyc", line 88, in pumpAll
  File "queueHandler.pyc", line 55, in flushQueue
  File "eventHandler.pyc", line 65, in _queueEventCallback
  File "eventHandler.pyc", line 217, in executeEvent
  File "eventHandler.pyc", line 96, in __init__
  File "eventHandler.pyc", line 105, in next
  File "browseMode.pyc", line 1563, in event_gainFocus
  File "speech\__init__.pyc", line 1087, in speakTextInfo
  File "speech\types.pyc", line 42, in __iter__
  File "speech\__init__.pyc", line 1127, in getTextInfoSpeech
  File "virtualBuffers\__init__.pyc", line 283, in getTextWithFields
  File "virtualBuffers\__init__.pyc", line 273, in _getFieldsInRange
  File "virtualBuffers\gecko_ia2.pyc", line 67, in _normalizeControlField
  File "garbageHandler.pyc", line 23, in __del__
  File "garbageHandler.pyc", line 63, in notifyObjectDeletion
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <appModules.outlook.UIAGridRow object at 0x054369B0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <NVDAObjects.UIA.UIA object at 0x0B93B410>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <NVDAObjects.IAccessible.IAccessible object at 0x04335E70>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <appModules.outlook.UIAGridRow object at 0x0C79C110>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <NVDAObjects.UIA.UIA object at 0x0547B6B0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <NVDAObjects.UIA.UIA object at 0x05530A30>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <NVDAObjects.IAccessible.IAccessible object at 0x05530DB0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <NVDAObjects.IAccessible.WindowRoot object at 0x05530E90>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <appModules.outlook.UIAGridRow object at 0x011C1A10>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IUIAutomationElement) ptr=0xbb4a0f8 at 1194ad0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IUIAutomationElement) ptr=0xbb97c20 at c5c0350>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IAccessible) ptr=0xbd1c638 at 549ff30>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IUIAutomationElement) ptr=0xbb98178 at 11ee0d0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IUIAutomationElement) ptr=0xbb4d308 at 5543670>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IUIAutomationElement) ptr=0xbb4d350 at 55437b0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IAccessible) ptr=0xbd1c6e8 at 11fb760>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IAccessible) ptr=0xbd1c3d0 at 11ee4e0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <NVDAObjects.window.Desktop object at 0x05530CF0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.685) - MainThread (23188):
Deleting unreachable object <POINTER(IUIAutomationElement) ptr=0xbb49d08 at b91ccb0>
WARNING - garbageHandler.notifyObjectDeletion (12:27:24.714) - MainThread (23188):
Deleting unreachable object <nvwave.WavePlayer object at 0x05549950>
ERROR - garbageHandler._collectionCallback (12:27:24.685) - MainThread (23188):
Found at least 21 unreachable objects in run
```

Resolving patch:
diff --git a/source/NVDAObjects/IAccessible/ia2TextMozilla.py b/source/NVDAObjects/IAccessible/ia2TextMozilla.py
--- a/source/NVDAObjects/IAccessible/ia2TextMozilla.py
+++ b/source/NVDAObjects/IAccessible/ia2TextMozilla.py
@@ -220,8 +220,12 @@ def _findContentDescendant(self, obj, position):
 		else:
 			obj=NVDAObjects.IAccessible.getNVDAObjectFromEvent(obj.windowHandle,winUser.OBJID_CLIENT,descendantID.value)
 		if position == textInfos.POSITION_CARET:
-			# Cache for later use.
-			self.obj._lastCaretObj = obj
+			# If the compound TextInfo is for the current focus,
+			# We should cache the caret object as we know it will probably be needed again.
+			# Note that event_loseFocus on NVDAObjects.IAccessible.ia2Web.Editor will clear the cache,
+			# To ensure we don't end up with a reference cycle.
+			if self.obj is api.getFocusObject():
+				self.obj._lastCaretObj = obj
 		# optimisation: Passing an Offsets position checks nCharacters, which is an extra call we don't need.
 		ti=self._makeRawTextInfo(obj,textInfos.POSITION_FIRST)
 		ti._startOffset=ti._endOffset=descendantOffset.value
diff --git a/source/garbageHandler.py b/source/garbageHandler.py
--- a/source/garbageHandler.py
+++ b/source/garbageHandler.py
@@ -42,9 +42,9 @@ def _collectionCallback(action, info):
 		_collectionThreadID = threading.currentThread().ident
 		_reportCountDuringCollection = 0
 	elif action == "stop":
+		_collectionThreadID = 0
 		if _reportCountDuringCollection > 0:
 			log.error(f"Found at least {_reportCountDuringCollection} unreachable objects in run")
-		_collectionThreadID = 0
 	else:
 		log.error(f"Unknown action: {action}")
 
@@ -57,13 +57,14 @@ def notifyObjectDeletion(obj):
 	global _reportCountDuringCollection
 	if _collectionThreadID != threading.currentThread().ident:
 		return
-	if _reportCountDuringCollection == 0:
-		log.error(
+	_reportCountDuringCollection += 1
+	if _reportCountDuringCollection == 1:
+		log.warning(
 			"Garbage collector has found one or more unreachable objects. See further warnings for specific objects.",
 			stack_info=True
 		)
 	log.warning(f"Deleting unreachable object {obj}")
-	_reportCountDuringCollection += 1
+
 
 
 def terminate():


Test patch: