gpt4 book ai didi

go - 股票代码仍然存在于内存中

转载 作者:IT王子 更新时间:2023-10-29 02:26:58 26 4
gpt4 key购买 nike

为什么当我初始化 ticker 然后更新它时,原始的 ticker 仍然存在于内存中,如果我进行循环,它会很快杀死我的 RAM

timeOut := 10
ticker := time.NewTicker(time.Duration(timeOut) * time.Second)
for {
ticker = time.NewTicker(time.Duration(timeOut) * time.Second)
}

最佳答案

Package time

import "time"

func NewTicker

func NewTicker(d Duration) *Ticker

NewTicker returns a new Ticker containing a channel that will send the time with a period specified by the duration argument. It adjusts the intervals or drops ticks to make up for slow receivers. The duration d must be greater than zero; if not, NewTicker will panic. Stop the ticker to release associated resources.


按照说明:停止自动收报机以释放相关资源。

关于go - 股票代码仍然存在于内存中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53935464/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com