Closed Lukas-Sturm closed 6 years ago
I have the same problem. Reading code, I track down problem to a malloc without free when no reading data from spi, as Dotstar use case. I generate a pull request fixing it (#27) . You can test my version here
Man, you saved my day. No, you saved my year 👍 Using your version memory seems to be balanced and not increase over time. Thank you very much for the work :)
Thanks for the report, apologies for not seeing it right way. Should be fixed in pi-spi@1.0.3
. (And shoutout here again to @maherma-adg who found the culprit, though fyi I fixed it in a slightly different way so please re-test just in case!)
Hello, I am currently developing a control software for my LEDs and I am having some memory problems. I am using the
dotstar
Library and that requires thepi-spi
Library for communication with the SPI-Bus. (It can take any SPI-Lib it just needs to implement a write function)I had my application running for some time and noticed that after some many hours the animations started to play super slow (1 update every 10 seconds) so I looked into the Problem. I created some heapdumps at various points of memory usage (eg. after start, at 50%, etc.) but chrome-dev-tools always sad that my application needs arround 8.5 MB. Then I read that buffers are not "tracked" by the heapdump, so I thought it might be the heavy use of buffers in the ´dotstar´-Lib. After some testing with my own code I saw that Node does not have problems with buffers. Then I thought it might be
setInterval
, but that was a false positive too.Then I tested my own SPI-Lib (just a class that implements a write function that does nothing) and see there the memory usage didn't increase after some hours of letting it run.
So at that point I am quite sure it might be something with
pi-spi
. What do you guys think, is it possible thatpi-spi
causes the memory leak in my application?I am using:
I also tried to find some other SPI-Libs for Node but can't seem to find one that fits my needs and
node-spi
is the same aspi-spi
?I realy hope someone can help me on this 👍