Open hush-soul opened 4 months ago
Every time it is stored for a period of time, the memory usage will increase. Even if the storage quantity has reached the upper limit, old files will be deleted and new files will be stored.
qnx
linux
Initially, I used the log interface of ap autorsa for testing. I created 15 processes and sent the log every 20ms. The memory usage increased wirelessly and very quickly.
In order to rule out AP problems, I used dlt-example-user to test, and the same problem also exists. It is currently under investigation. I would like to ask if there have been similar problems before.
I observed a phenomenon, dlt-daemon stack = 32kb in qnx, so the memory increases by 32kb each time
I found that this problem occurs when only performing the first and third steps 1.dlt-daemon -d -c /etc/dlt.conf 2.//dlt-logstorage-ctrl -c 1 -C /etc/dlt.conf -p /etc/dltlog 3.dlt-example-user -d 5 -n 10000 Hello123
I found that this problem occurs when only performing the first and third steps 1.dlt-daemon -d -c /etc/dlt.conf 2.//dlt-logstorage-ctrl -c 1 -C /etc/dlt.conf -p /etc/dltlog 3.dlt-example-user -d 5 -n 10000 Hello123
This test is wrong. When the storage is not set, it will stop when it reaches the RingbufferMaxsize. It does not stop when the storage is set.
I did some testing on Linux using valgrind Using 15 processes, each process sends a log every 20ms. The results are shown in Figure 4.
time:16h
So I looked at dlt_offline_logstorage_behavior.c:494 I found that the function dlt_logstorage_close_file when using DLT_LOGSTORAGE_USE_GZIP does not call fclose, only gzclose
I don't know if there are other considerations. So I just modified it myself and tested it. @minminlittleshrimp Modification 1: Modification 2:
The results are as follows: On the left,
there are other places I may continue to test
dlt_logstorage_storage_dir_info Move the allocation outside the loop Seems to have solved the problem
solvedsolved
Hello @hush-soul Thanks for raising your concern. May I ask for the fix, is it delivered in any PR yet?
Hello @hush-soul Thanks for raising your concern. May I ask for the fix, is it delivered in any PR yet?
Of course, you can check PR #666
Thank you for providing the fix, we will review. For now I would like to reopen this issue and will close together when the fix merged.
I tested it on both qnx and linux use dlt-daemon -d -c /etc/dlt.conf dlt-logstorage-ctrl -c 1 -C /etc/dlt.conf -p /etc/dltlog dlt-example-user -d 5 -n 10000 Hello123