Avatar for wagnerf42

wagnerf42

Member since Jul 2022 • Last active Mar 2023
  • 3 conversations
  • 13 comments

Most recent activity

    • 13 comments
    • 561 views
  • 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

    hi,

    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.

  • in JavaScript
    Avatar for wagnerf42

    i extracted my city's ways from openstreetmap. with some clever encoding (btw i laughed at Uint24Array but it's just what i needed) i'm actually below 200k. i'm amazed it's fast enough to display on the watch with little optimisations (1.5 secs to display). i still need to add the street names and port the low mem path algorithm to javascript and we might have a full gps. i'm not still 100% sure the path algorithm will fit the ram though, it's kind of a challenge. well, all the stuff i like.

  • in JavaScript
    Avatar for wagnerf42

    yeah. it's all good. thanks again.

  • in JavaScript
    Avatar for wagnerf42

    ok, i'll give it a try. thanks a lot

  • in JavaScript
    Avatar for wagnerf42

    oh i didn't see your workaround. thanks again, i'll give it a try

  • in JavaScript
    Avatar for wagnerf42

    ok, thanks for the quick answer. i think i actually may be able to have a workaround with inline c and strings

Actions