3 ms·
> any C++ compiler can be made to use exponentially large amounts of memory and CPU time by feeding it a specially crafted program Doesn’t even need to be spec
by oefrha 7y ago
> any C++ compiler can be made to use exponentially large amounts of memory and CPU time by feeding it a specially crafted program
Doesn’t even need to be specially crafted, I wrote a <100 line C++ program to solve a Project Euler problem just yesterday that runs in 0.5s with ~2.5GB of RAM but takes clang++ 50GB of RAM to compile. I could easily tweak a param to make it use any multiple of that to exhaust the RAM on any workstation. Surprised me a bit honestly.
- MHM5000 7y agoOff-topic: C++ Newbie here! I would like to see that code and its tweaked version. If at all possible.
- optimiz3 7y agoQuick way to do it would be to calculate some high index in a fibbonacci sequence at compile time using templates.
- anchpop 7y agoI think this might be considered a bug if it's a reasonable program
- a_t48 7y agoProbably just over-(ab)use of templates. :)
- oefrha 7y agoMy program’s much more mundane than using templates as a Turing complete language at compile time. Just a slightly tricky static node pool for a persistent segment tree. Allocating a larger pool causes more RAM usage at compile time, at a 20+x ratio. Probably not gonna share code since I didn’t bother to distill it down to the cause.