Without seeing any code we can only offer generalities.
The behavior that you describe can be caused by reading and/or writing beyond the bounds of an array. Examine all array operations to make sure that that is not happening.
Using the String class can cause memory problems that can lead to crashes.
Or just running out of SRAM.
Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.