{"slug": "show-hn-static-allocation-mlp-inference-in-ansi-c-using-a-2-slot-ring-buffer", "title": "Show HN: Static-allocation MLP inference in ANSI C using a 2-slot ring buffer", "summary": "A developer has released a fully static-allocation MLP inference implementation in ANSI C that uses a 2-slot ring buffer to minimize RAM usage on microcontrollers. The approach, developed since 2019, aims to achieve the practical lower bound for memory consumption in general-purpose CPU MLP inference without sacrificing speed or adding runtime complexity. The project is available on GitHub for comparison with other minimal inference implementations.", "body_md": "I've been experimenting since 2019 with ways to minimize RAM usage for tiny MLP inference on microcontrollers. [0]\n\nThis project is the result of that exploration: a fully static-allocation approach to MLP inference in ANSI C, using a simple 2-slot ring buffer to keep memory usage predictable and extremely low, while at the same time fast.\n\nI believe this is close to the practical lower bound for RAM usage in general-purpose CPU MLP inference without sacrificing speed or introducing runtime complexity.\n\nA more aggressive approach I've previously used is allocating and freeing memory per layer-to-layer pair during inference, but that introduces overhead and fragmentation if not used carefully. [1]\n\nCurious how it compares to other minimal inference implementations people have seen (or built). Feedback and edge cases welcome. Hope you like it. Have fun. <3\n\n[0]: [https://github.com/GiorgosXou/NeuralNetworks#-research](https://github.com/GiorgosXou/NeuralNetworks#-research)\n[1]: look for REDUCE_RAM_DELETE_OUTPUTS in the source of [0]\n\nComments URL: [https://news.ycombinator.com/item?id=48318304](https://news.ycombinator.com/item?id=48318304)\n\nPoints: 1\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-static-allocation-mlp-inference-in-ansi-c-using-a-2-slot-ring-buffer", "canonical_source": "https://github.com/GiorgosXou/MLPico", "published_at": "2026-05-29 02:32:01+00:00", "updated_at": "2026-05-29 02:45:07.266587+00:00", "lang": "en", "topics": ["neural-networks", "machine-learning", "ai-infrastructure"], "entities": ["ANSI C", "GitHub", "GiorgosXou"], "alternates": {"html": "https://wpnews.pro/news/show-hn-static-allocation-mlp-inference-in-ansi-c-using-a-2-slot-ring-buffer", "markdown": "https://wpnews.pro/news/show-hn-static-allocation-mlp-inference-in-ansi-c-using-a-2-slot-ring-buffer.md", "text": "https://wpnews.pro/news/show-hn-static-allocation-mlp-inference-in-ansi-c-using-a-2-slot-ring-buffer.txt", "jsonld": "https://wpnews.pro/news/show-hn-static-allocation-mlp-inference-in-ansi-c-using-a-2-slot-ring-buffer.jsonld"}}