Today, I encountered a memory leak with a simple bit of code that's interfacing with a GPS module using the GPS library. Specifically, about 2-3 blocks of memory were leaking every 5 seconds (or so) until the GPS got a 'satellite lock'. This may have something to do with how my module transmits data pre-lock, or could be a mistake that I've made (as I'm new to Espruino) . In case it's relevant, the GPS Module that I'm using is the Adafruit 'Ultimate GPS Module' with MTK3339 chipset.
Initially, I thought the memory leak was something in my code, and I was in the process of tracking that down when the GPS got a 'lock' and the memory leak stopped. I stripped my code down to the minimum, and grabbed three process.memory() and trace() dumps, two before the 'satellite lock', and one after.
Here's the code that I was testing this with:
Serial4.setup(9600,{tx:C10,rx:C11});
var gps = require("GPS").connect(Serial4, function (data) {
if ((data.time.substr(-2))=="00") {
console.log("time = "+data.time);
console.log("lat = "+data.lat);
console.log("lon = "+data.lon);
}
});
Immediately after uploading the code, process.memory() returned the info below. The matching trace file is called 'trace-start.txt'
Finally, the satellite locked when 576 blocks of memory had been used, and the memory leak stopped. process.memory() returned the info below. The matching trace file is called 'trace-satlock.txt'
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi Folks -
Today, I encountered a memory leak with a simple bit of code that's interfacing with a GPS module using the GPS library. Specifically, about 2-3 blocks of memory were leaking every 5 seconds (or so) until the GPS got a 'satellite lock'. This may have something to do with how my module transmits data pre-lock, or could be a mistake that I've made (as I'm new to Espruino) . In case it's relevant, the GPS Module that I'm using is the Adafruit 'Ultimate GPS Module' with MTK3339 chipset.
Initially, I thought the memory leak was something in my code, and I was in the process of tracking that down when the GPS got a 'lock' and the memory leak stopped. I stripped my code down to the minimum, and grabbed three process.memory() and trace() dumps, two before the 'satellite lock', and one after.
Here's the code that I was testing this with:
Immediately after uploading the code, process.memory() returned the info below. The matching trace file is called 'trace-start.txt'
A few minutes later process.memory() returned the info below. The matching trace file is called 'trace-422.txt'
Finally, the satellite locked when 576 blocks of memory had been used, and the memory leak stopped. process.memory() returned the info below. The matching trace file is called 'trace-satlock.txt'
I'd be interested in anyone's thought of ideas on this problem.
Thanks.
3 Attachments