[VOL-4929] openonuAdapterGo - memory leak seen in long term tests

Change-Id: I1e57aa0a63aa0f8fd084eabc9f1c774fe120b616
diff --git a/VERSION b/VERSION
index 2d6d89e..834f262 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.7.4-dev
+2.8.0
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index e227543..e6bfea6 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -4677,12 +4677,14 @@
 		dh.pOnuTP.PrepareForGarbageCollection(ctx, aDeviceID)
 	}
 	if dh.pOnuMetricsMgr != nil {
-		dh.pOnuMetricsMgr.PrepareForGarbageCollection(ctx, aDeviceID)
+		logger.Debugw(ctx, "preparation of garbage collection is done under control of pm fsm - wait for completion",
+			log.Fields{"device-id": aDeviceID})
 		select {
 		case <-dh.pOnuMetricsMgr.GarbageCollectionComplete:
 			logger.Debugw(ctx, "pm fsm shut down and garbage collection complete", log.Fields{"deviceID": aDeviceID})
 		case <-time.After(pmmgr.MaxTimeForPmFsmShutDown * time.Second):
 			logger.Errorw(ctx, "fsm did not shut down in time", log.Fields{"deviceID": aDeviceID})
+		default:
 		}
 	}
 	if dh.pAlarmMgr != nil {
diff --git a/internal/pkg/pmmgr/onu_metrics_manager.go b/internal/pkg/pmmgr/onu_metrics_manager.go
index a686d77..3da45b0 100755
--- a/internal/pkg/pmmgr/onu_metrics_manager.go
+++ b/internal/pkg/pmmgr/onu_metrics_manager.go
@@ -3993,20 +3993,3 @@
 	defer mm.OnuMetricsManagerLock.Unlock()
 	mm.deviceDeletionInProgress = true
 }
-
-// PrepareForGarbageCollection - remove references to prepare for garbage collection
-func (mm *OnuMetricsManager) PrepareForGarbageCollection(ctx context.Context, aDeviceID string) {
-	currState := L2PmStNull
-	if mm.PAdaptFsm != nil && mm.PAdaptFsm.PFsm != nil {
-		currState = mm.PAdaptFsm.PFsm.Current()
-	}
-	if currState == L2PmStNull {
-		logger.Infow(ctx, "pm fsm already stopped, safe to garbage collect", log.Fields{"device-id": mm.deviceID})
-		mm.pDeviceHandler = nil
-		mm.pOnuDeviceEntry = nil
-		mm.GarbageCollectionComplete <- true
-		return
-	}
-	logger.Debugw(ctx, "prepare for garbage collection - no action, garbage collection done when PM FSM is stopped",
-		log.Fields{"device-id": aDeviceID, "curr-fsm-state": currState})
-}