[VOL-4548] openonuAdapterGo - memory leak seen in long term tests
Change-Id: I306e3b8d9529ba1ffb43f93cd70524931d7c5e3c
diff --git a/internal/pkg/onuadaptercore/omci_onu_upgrade.go b/internal/pkg/onuadaptercore/omci_onu_upgrade.go
index dbdad2b..b9b98af 100644
--- a/internal/pkg/onuadaptercore/omci_onu_upgrade.go
+++ b/internal/pkg/onuadaptercore/omci_onu_upgrade.go
@@ -1910,3 +1910,13 @@
oFsm.volthaImageState = voltha.ImageState_IMAGE_UNKNOWN //something like 'IMAGE_DOWNLOAD_ABORTED' would be better (proto)
}
}
+
+// PrepareForGarbageCollection - remove references to prepare for garbage collection
+func (oFsm *OnuUpgradeFsm) PrepareForGarbageCollection(ctx context.Context, aDeviceID string) {
+ logger.Debugw(ctx, "prepare for garbage collection", log.Fields{"device-id": aDeviceID})
+ oFsm.pDeviceHandler = nil
+ oFsm.pDownloadManager = nil
+ oFsm.pFileManager = nil
+ oFsm.pDevEntry = nil
+ oFsm.pOmciCC = nil
+}