Created
February 18, 2024 14:19
-
-
Save gkampitakis/0cb9690f5e8c265e90a7cdc25a6d0137 to your computer and use it in GitHub Desktop.
Memory leaks in Go - Not stopping time.Ticker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
for { | |
ticker := time.NewTicker(1 * time.Second) | |
// do something with the ticker | |
_ = <-ticker.C | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment