alexa / avs-device-sdk

An SDK for commercial device makers to integrate Alexa directly into connected products.
https://developer.amazon.com/alexa/alexa-voice-service
Apache License 2.0
1.26k stars 602 forks source link

We found a memory leak during AVS AQT testing #1703

Closed PerSpc closed 3 years ago

PerSpc commented 4 years ago

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

When the device is on device playback, there will be a memory leak after about 3 hours. Through observation, it is found that only during TTS playback will memory leak occur.

What is the expected behavior?

cat /proc/pid_xxx/status VmRSS: 60572 kB VmRss will not increase after 3 hours of continuous test.

What behavior are you observing?

During AQT device playback testing, memory changes.

Provide the steps to reproduce the issue, if applicable:

1) Start AQT device playback testing 2) cat /proc/pid_xxx/status 3) After about 3 hours of testing, compare the memory changes

Tell us about your environment:

What version of the AVS Device SDK are you using?

  Version 1.19.0 alexa-client-sdk

Tell us what hardware you're using:

Tell us about your OS (Type & version):

samcoult commented 4 years ago

Hi @PerSpc ,

Thank you for contributing to the AVS Device SDK.

I have created an internal tracking ticket to get this issue investigated and fixed.

PerSpc commented 4 years ago

Hi samcoult, Thank you for your help,Let me synchronize the test results on my side. This is the result of two and a half hours of testing: cat /proc/3318/status VmHWM: 33124 kB -----> VmHWM: 71980 kB VmRSS: 33124 kB -----> VmRSS: 70924 kB

cat /proc/meminfo MemAvailable: 72392 kB ----> MemAvailable: 31952 kB

Version of gstreamer: gstreamer1-1.10.4 Version of avs-sdk: Version 1.19.0

mvelegon-amzn commented 3 years ago

Hi @PerSpc could you give us some more details on the platform you are using?

Also, it would help if you run a heap tracer such as valgrind or heaptrack to get an idea of the heap memory usage.

We ran similar tests with the SDK and concluded that looking at RSS by itself is not a good measure to find out actual memory used by the application. The reason is the heap allocator tries to optimize for speed by minimizing locking and allocates more memory from the OS and also it does not always free memory back to the OS.

kclchan commented 3 years ago

I am closing this issue due to inactivity. If you have further questions, please open a new ticket and refer to this closed one.