Reputation: 14824
Does the variable in this bit of code get garbage collected after the loop finishes or do I have X amount of sSteamId
variables floating in memory forever?
If it does, how can I do this more efficiently? I only need sSteamId
long enough to convert an int
to a string
and then append it to a byte
, then it's no longer needed
for _, id := range steamIds {
sSteamId := strconv.Itoa(id)
requestURI = append(requestURI, ","+sSteamId...)
}
Upvotes: 2
Views: 667
Reputation: 118774
They'll get GC'd as any references to them are lost with each iteration.
Upvotes: 2