Leonardo lose Data

Hi, i have a problem.

The setting:
I build a circuit with a Leonardo to control a step motor with a three phase encoder. The encoder uses the three external interrupts. Additional I have 3 Inputs and 5 Outputs. Everything is fine.

But when i do nothing for a while (like 30min) the Leonardo lose his data.
My question is: What can erase the data of the leonardo? I think its no reset but he just lose all data.

Let's see your program and circuit.
Where is it losing the data from and what is the data ?

thank you for your fast response

the data is the position of the step motor written in a variable , after a break sometimes the variable is 0, so the position is lost till the step motor drive into the next index of the encoder

The Leonardo is never "doing nothing" so what is it doing ? Put some code, perhaps flashing an LED or output to the Serial monitor in setup() so that you can tell whether a reset happens.