eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.

Home Page:http://mraa.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Explicit object cleanup for garbage-collecting languages

jan-kiszka opened this issue · comments

Looking for something put into the close handler of https://github.com/node-red/node-red-nodes/blob/master/hardware/intel/mraa-gpio-dout.js#L31. That shall stops that mraa nodes keep GPIOs open until the JS garbage collector finally decides to clean up. But I suppose there is nothing in the mraa API so far, is there?

And this issue should not be limited to GPIOs, correct?

How about other languages that do not support some "delete object"`, thus controlled invocation of the destructors?

So the language bindings are based on the CPP headers, when an object is destroyed, https://iotdk.intel.com/docs/master/mraa/gpio_8h.html#ac18f83fc915a25f06513dbd8ea0d4bad should be called. But yeah, I think maybe extra care needs to be taken in some environments.

We are currently trying siemens/meta-iot2050@633a77e#diff-efeb60c6a49d15c96eeef5e011f89bfd8f22df93a33ecdb012407d7b5a609e7a (plus siemens/meta-iot2050@37ca6cf#diff-eec4e82a3f9112c200a581affc24bc44fa75f056ed893b3c9cda6fae2171ce28) on a customer setup, hoping that this fixes the sporadic issues seen there. If that works, I'll send an PR for that mraa patch (eventually also for the board, but that needs more work).