Avatar for wagnerf42


Member since Jul 2022 • Last active Aug 2023
  • 4 conversations

Most recent activity

  • in Bangle.js
    Avatar for wagnerf42

    i gave a try building a small example from scratch but it did not work. so i guess i'll need to start from the full code and trim it. that'll take some time though.

  • in Bangle.js
    Avatar for wagnerf42

    hi, so just to let you know, i've been commenting in and out large blocks of code and i finally found the problem. there is a problem in the jit in case of array allocations.

    multiple array allocations seem to trigger the bug easily but single array allocation also does it sometimes. putting back the jit i do get a 10% perf increase. that's much less than the initial 50% i got (before optimizing the code manually) but i guess i'll keep it, at least for a bit of testing.

    as for the watchdog i just thought i don't really need it anymore so i should just max the interval.
    i'll put it back to the standard value. thanks.

  • in Bangle.js
    Avatar for wagnerf42

    hi, i'm not too sure.
    i'm able to reproduce the crashes deterministically though.

    it's not the jit alone because when disabling it completely i also managed to get the bug.

    i figured out that this line (758):

                Bangle.setPollInterval(2000); // disable accelerometer as much as we can (a value of 4000 seem to cause hard reboot crashes (segfaults ?) so keep 2000)

    seem to cause problems at 4000. just switching to 2000 it seems there are no problems anymore.

    however it's not the end of the story because i have two different methods for which i'd like to use the jit. 'display_tiles' and 'display_thick_tiles'.
    when i tried on both it always crashed.
    when i tried on 'display_tiles' alone it used to work (before my latest changes on powersaving).
    but now after the changes when i try on 'display_tiles' alone the behavior is very strange.
    it does not crash but the screen flickers, with the streets not being displayed and i get weird messages in the console about incorrect code which does not exist.

    i was wondering if i was hitting some limits on memory size.

    if you like i can help you reproduce it.

  • in Bangle.js
    Avatar for wagnerf42

    no, that's just the cpu the algorithms take to draw the map (and figure where you are if lost).
    i'm speaking about the cutting edge version in the git which encounters a bug.

  • in Bangle.js
    Avatar for wagnerf42


    i have some problems with some unpredictable reboots when running gipy.

    the watch just reboots more or less randomly. there is no error message on the console nor on the watch itself. i'm not sure what is causing this.

    i know that adding "jit"; to the display_thick_tile method in the Map class will guarantee an immediate reboot 100% of the time. however if i don't have it there is still a reboot. if i remove the "jit"; in the display_tile method (the jit i currently use) the reboots frequencies decrease but i still have it. if i remove the widgets loading and drawing it decreases even further but i still have it.

    my guess is that there is a kind of memory limit i'm reaching but i don't know what.
    process.Memory() is not helping me since everything seems ok.
    half the memory is free, i still have 48000 of stack.

    i'm really not sure what to do here.

  • in Bangle.js
    Avatar for wagnerf42

    yes, this guy : https://pastebin.com/D5k8NFhh

    is not freeing the memory.
    when i start the go_to method line 358 i have little memory remaining.
    however commenting out line 358 and removing comments 572-577 it works.

  • in Bangle.js
    Avatar for wagnerf42

    yeah that's what i thought. if i declare a global "street" variable, set it in the menu handler and use setInterval in the main to detect for the variable being set then it effectively frees the menu's memory. however i expected it to be also true if using a setTimeout in the handler itself since i thought the timeout's function would not be associated with the menu (the menu's handler registers the timeout and completes) and this is not the case.

    so i have the setInterval workaround which is fine, i'm not stuck but somehow it still don't get why the garbage collector is not freeing the memory if i use a timeout.

  • in Bangle.js
    Avatar for wagnerf42


    i'm getting tight with my memory usage so I started profiling it a little bit.

    i'm actually starting my app with a few menus and these guys require quite a lot of memory allocations: i need to decompress a few arrays using heatshrink.

    now, after i select my entry in the menu i can safely free all this memory and live happily ever after.
    i just need to keep a very tiny array i created in the callback.

    however i'm not sure how to do that. i don't see how to wait in the main function for the menu to return so i usually launch my code in the menu entry's callback itself. if i do that however, all large arrays stay allocated. i tried to use a timeout to create a new task and return from the menu callback which works but does not free my memory.

    i'm actually not even sure how the garbage collector is working.

    i'm not sure i'm clear. my code is here : https://github.com/wagnerf42/gps/blob/ma­in/app.js
    i want to call the function on line 357 with the local street array and free the memory decompressed line 321.