Reputation:
After having successfully implemented the karatsuba algorithm, I decided to compare the time needed with the school algorithm. The program needs to test up to 32768 digits. Unfortunately, it stops at 8192 digits(the digits are stored in an array). When running it with gdb I get the output: Programme terminated with SIGKILL, Killed
. So obviously I searched through the web and found out that(since I'm on Linux), the kernel automatically killed the program because it consumed too much of resources.
So my question is: Is there a way to keep it running?
Thanks in advance for any response
Upvotes: 1
Views: 170
Reputation: 426
I see a number of things you should do before forcing Linux to keep your program running (if you could do that anyway).
I hope this helps to find a solution.
Kind regards, PB
Upvotes: 0
Reputation:
The most probable cause is memory exhaustion. You can roughly test this hypothesis by running top
on the terminal.
If this is the case, valgrind
is your friend. Look very carefully at every place you call malloc
in your program and ensure that you call free
for each array afterwards.
Upvotes: 1