Esp-12 f hanging/freezing after some random time of running

I am using ESP-12 F in one of my project of watering where it gets connected to Internet and synchronizes with timeserver which run regularly to update to correct time, at defined time it performs an output operation to switch relay on, it also has feature to turn relay on using switch as an in input , kindly help as after some running the esp-12f would hang/freeze and not respond to any switch inputs until the entire module is restarted by powering supply on/off to module after some random time it sometimes runs without any freeze/hang for constant 7-8hours, is it any low memory that can cause or kindly guide what may be the cause of this

Please post the code using the </> button here.
If possible post a wiring diagram showing the power supply connections.

Not an uncommon problem, there may be problems with your sketch which you should look at
See my tutorial on Taming Arduino Strings which covers String problems and also has code to auto-reboot your ESP every few hours

thx ..as I'll share the code soon as system having it is bit slow , seeing the link to handle the issue you mentioned of out of memory I hope that's correct, but if ESP-12 F runs out of memory and cause such issue won't hardware watchdog kickin also I also have a reboot programmed but after every 12hrs..do let me know on watchdog thing related to out of memory

You would expect that, by my experience is that does not always happen. I think the stack for the function call to reboot etc get screwed