Thanks for taking a look. I appreciate it.
I take it that's not on an RPi?
Sorry, yes, I should have made that clear. See my last post.
You have a strange way of including bint.h, normally <bint.h> is used for a system heade
Good point. Thanks. Not what I normally do. I will fix it.
I just realised I'm timing it with profiling but it's already taken 15 minute...
Ha!. Time for a funny story...
As I was hacking on this I compiled it with address sanitizer enabled. Like so:
Code: Select all
$ g++ -Wall -O0 -ggdb -fsanitize=address -fno-omit-frame-pointer -o bint_test bint_test.cpp bint.cpp -I.
After all, who would not want to know about "use after free" and memory leak errors as they develop stuff. C++ is so crazy you need those kind of tools to stay sane.
Well, when it was running well enough to calculate fibo(20000) I let it rip on fibo(4784969). It was taking some time so I left it and went to sleep.
Many hours later I return to find it is still running! It is using all my memory and thrashing swap space very heavily.
Then I realize my mistake. I forgot to compile without address sanitizer enabled.
So... that thing had been hammering on my SSD all night. No doubt shortening it's life by years.
Memory in C++ is a leaky abstraction .