A common issues for the errors like this:
 kernel panic - not syncing: Fatal exception
is probably, because of a bad memory allocation or utilization. For instance:
- You haven’t allocated enough memory space and then, if you try to access or put an element at a certain memory position, in which doesn’ t exist you’re gonna have kernel panic. This is similar to what happens if you are working on userspace level, but instead of getting ‘kernel panic’ you’ll probably get ‘segmentation fault’ as the error.
- You have a pointer variable which is not currently pointing at any memory space. It’s NULL. In this way, if you try to use that pointer with the operator ‘->’, you will get ‘kernel panic’ as well. This is similar to what would happen on userpace level, but instead of getting ‘kernel panic’, we probably would get something like ‘segmentation fault’ or simply, the program freezes.
- You have a quite long run loop and at each iteration, kernel memory allocation is happening, which may result in lack of memory space.
Hope I helped you,