Memory leak
First, thanks for your perfect works. I got a issue when writing BLF file.I will write 1000 can frames every 40ms, and i saw the memory of my software is increasing slowly, even i write 100 can frames it also increasing.I'm looking for the reason too.
Comments (9)
-
-
repo owner Hello Zheng,
the code looks ok. You can make some things simpler:
- On construction of CanMessage and CanFdMessage the following variables are already set: objectType, objectVersion. So you can delete these lines.
- On writing of CanMessage and CanFdMessage the following variables are set automatically: headerSize, objectSize. So you can delete these lines.
- Objects can either be constructed with “new” (as done with CanMessage”) or with “createObject” (as done with CanFdMessage). I propose to use “new” also for CanFdMessage, as that’s simpler and faster.
Now to the memory leak: It might be that the sizeof() call causes the memory leak. As mentioned it’s auto calculated, so can just delete these lines. Can you test, if the memory leak is gone then?
Part of my tests is also to run vagrant leak checker. And in the last version it didn’t showed any issues… I’ll wait for your feedback before proceeding with further tests.
Bye
Tobias
-
repo owner - changed status to open
Issue might be caused by usage of "sizeof()". But let's wait for the feedback.
-
I’m sorry to say, it not work. As you said i modified my code as below
I had added print in readWriteQueue2UncompressedFile function, before delete. And the objects is really deleted.
-
I write an other test code, just new a can message then delete it without write function, memory is also increasing.
-
It’s not the library is bug, it our code’s. Sorry and thanks.
-
repo owner Hi Creed,
I’m glad to hear that. So you found the bug and fixed it. That’s all that counts
Bye
Tobias
-
repo owner - changed status to resolved
Issue fixed in customer software.
-
repo owner -
assigned issue to
-
assigned issue to
- Log in to comment
here is how i write data ! I have not try can-fd frame.