You are reading a single comment by @maze1980 and its replies.
Click here to read the full conversation.
-
Looks like I2C.readFrom already returns an Uint8Array, so I think you are doing a double allocation.
Not sure, but I think your memory usage might be smaller with just:var data = read(register, length);
Or not, or might not even be measurable, if that allocation is just in a small function, and the GC frees up memory...
Just a code snipped:
I didn't try/check your code in detail, but I'd suggest to define data (or b) as Uint8Array.