1- why does it crash & reset?
2- why does it fail to connect after reset?
#1 is most likely the program, but could also be from the usual suspects - power that's not stiff enough, interference. Capacitors and pullups are the first line of defense
#2 is interesting. If you're in AP mode, then what network info is required?
I've had ESPs running as stations and clients for over a week with zero resets, but not doing as much as yours is.