You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • Avoid printing interpreter error messages

    I understand why, but it makes problem determination a bit more difficult

    The errors that get reported are those from E.getErrorFlags() - generally they don't have much to do with the code that's running... For instance the 'out of memory' error is probably because something's being appended to an array - but it will rarely happen where the append itself is (more likely it'll be some other area of completely useless code).

    If it is an issue, you can still track it down by adding E.getErrorFlags() in your code, or even calling it from the debugger.

    require ... What is the notice now?

    It's the same error as before. It just doesn't also tell you that there was a filesystem error (which is a bit of a red herring if you have no SD card!).

    I have situations where after 'consummation' of modules there is no value anymore to keep it in the Modules cache.

    Just do Modules.removeAllCached or Modules.removeCached once you have required what you need?

    However in many cases that may not save you much memory at all, since in JS a function has to have access to the scope it was defined in - so if you've kept any function at all, it'll stop that whole module from being freed.

    Don't warn the user when we had to run a GC pass during execution... How is this information now passed on to monitoring applications?

    Check out the E.getErrorFlags docs: http://www.espruino.com/Reference#l_E_ge­tErrorFlags

    You get 'LOW_MEMORY' - it's just that it isn't reported to the user, as in nearly all cases it doesn't matter.

    It is helpful to get this information. Option of adding setWatch()-like constructs would be of great help...

    Potentially there could be an E.on event fired when the error state changes? I just wonder whether anyone would use it... You're the first person to ever request something like that as far as I know.

  • may not save you much memory at all (with removing a module from Modules cache

    In my case it was a lot of human readable data and thus quite verbose that gets binary-ized and stored in vars on execution of require() and before save() - transformation from source data into runtime data - and the source is not needed anymore, nor the transformation function (and with the removal from the Modules cache I would expect the garbage collect collecting all, because nothing in runtime references anymore anything of this data in source format and it's related transformation function code.

    You're the first person to ever request something like that as far as I know.

    In the spirit of Espruio's event driven-ness, I'm surprised... I would like to have something like that... because I do not want to put try/catches around the code or ask for error flag after execution/call of code that could set any of these flags, but it would be nice to be able to hold on / get notice of the even. It is good for monitoring that status / health of an app. E.on(..., is most likely the right place to hook in, because it is Espruino specific but not a hw pin / signal thing.

About

Avatar for allObjects @allObjects started