RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/humble/Concepts/Basic/About-Client-Libraries.html?highlight=rclnodejs#community-maintained
Apache License 2.0
311 stars 70 forks source link

Fix crashing on Electron > 21 #921

Closed minggangw closed 1 year ago

minggangw commented 1 year ago

Since Electron 21, the V8 sandboxed pointers was enabled, which disables creating a new BackingStore and taking over an external memory block. Instead, we must copy the data into a newly-allocated memory that is inside V8 memory cage.

See more details: https://www.electronjs.org/blog/v8-memory-cage

This patch fixed the crashing when running on Electron > 21.

Testing

  1. Electron v25.0.1 with Iron

    • Automated test: electron --expose-gc ./scripts/run_test.js
    • Manually tested: electron example/subscription-message-example.js & node example/publisher-message-example.js
    1. Nodejs v18.16.0 with Iron
    • Automated test: npm test

Fix #864