MCU is restarted every time I compile the code

I had noted that every time I compile a sketch, if the MCU is connect, it is restarted. Is it normal? I’m using the latest version of esp32-arduino framework.

If I use a standard sketch

#include <Arduino.h>
int i=0;
void setup(){

void loop() {
    Serial.println("Iteration " + String(i++));

that will continously increase a counter and open an external serial monitor program (hterm.exe), I get the output

Iteration 15
Iteration 16
Iteration 17

and I then hit the “Build” button again, the program keeps running without interruption.

If i use “Upload and Monitor” to get the built-in serial monitor, and then press “Build” again, the

entry 0x400806a8
Iteration 0
Iteration 1
Iteration 2
Iteration 3
Iteration 4
Iteration 5
Iteration 6
Iteration 7
Iteration 8
Iteration 9
Iteration 10
<press build>
<build output in new tab>
<press a key to close the tab to return to serial monitor>
Iteration 26
Iteration 27
Iteration 28

the output still keeps running, so I can’t reproduce the problem.