TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Heap on Embedded Devices: Analysis and Improvement

37 pointsby dimonomidover 9 years ago

8 comments

omgtehlionover 9 years ago
Wow wow, if you are using a heap on really small embedded device you&#x27;re gonna have a bad time any way.<p>Embedded engineering 101: statically allocate everything, and try not to push the stack too much. But you can not do this with JS :(
评论 #10980567 未加载
评论 #10983149 未加载
daphreakover 9 years ago
&quot;I have worked with a few embedded SDKs (by Microchip, Keil and Espressif), and all of them have a really dumb built-in implementation of the heap.&quot;<p>Many embedded systems allocate just once at startup and these &quot;really dumb&quot; implementations are completely sufficient. The vendors provide a fast, low-overhead solution by default and trust that developers can go find a more appropriate allocator if they need it for their application. Luckily we have many implementations to choose from!
评论 #10980307 未加载
评论 #10982095 未加载
flyinglizardover 9 years ago
Generally speaking, you should try really hard to avoid using the heap in any system that has no virtual memory support. Heap fragmentation will ultimately get your app.<p>The exception is in state machines where you know, in a deterministic way, what the memory layout should be at every given state, and then you can use heaps to get memory overlap between code pieces that operate exclusively of each other.
cornellwrightover 9 years ago
While it&#x27;s nicely written, my first question is why are you running JS on a microcontroller?
评论 #10983061 未加载
plasticchrisover 9 years ago
The allocator that comes with free rtos (I assume he&#x27;s using it as he mentions pvPortMalloc) can be extended to support realloc efficiently without too much trouble so that it will resize if possible. For example <a href="https:&#x2F;&#x2F;github.com&#x2F;hello&#x2F;heap_6" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hello&#x2F;heap_6</a>
评论 #10980810 未加载
plasticchrisover 9 years ago
From 2010, very similar approach: <a href="http:&#x2F;&#x2F;www.asyndetic.com&#x2F;2010&#x2F;07&#x2F;30&#x2F;visualizing-the-heap-on-embedded-systems-part-ii&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.asyndetic.com&#x2F;2010&#x2F;07&#x2F;30&#x2F;visualizing-the-heap-on-...</a>
shenbergover 9 years ago
Don&#x27;t set a constant poison, the attacker will just overwrite the poison with A5s. Generate a random byte on start-up.
评论 #10983179 未加载
poseidover 9 years ago
interesting visualizations