Memory leak on SendSoap ONVIF library #154
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Pull Request: Memory Leak on SendSoap ONVIF Library
Motivation and Improvement
This pull request addresses a critical memory leak issue in the SendSoap function of the ONVIF library. Memory leaks can lead to increased memory usage over time, which can degrade the performance and reliability of the application. By fixing these leaks, we ensure that the system remains stable and efficient over long periods of operation.
Summary of Changes
Update ONVIF Library:
v0.0.16
tov0.0.17
ingo.mod
andgo.sum
files. This update includes important bug fixes and improvements, particularly addressing memory management issues.Ensure Response Body Closure:
resp.Body.Close()
calls immediately after reading the response body to ensure that the response body is always closed, preventing potential memory leaks.ConnectToOnvifDevice
,GetTokenFromProfile
,GetPTZConfigurationsFromDevice
,GetPosition
,GetPresetsFromDevice
,GoToPresetFromDevice
,CreatePullPointSubscription
,UnsubscribePullPoint
,GetEventMessages
,GetDigitalInputs
,GetRelayOutputs
, andTriggerRelayOutput
to ensure proper resource cleanup.Why It Improves the Project
These changes are critical for ensuring the long-term health and performance of the application, particularly in environments where the ONVIF functionality is heavily utilized.