heap dump from pprof
heap dump from pprof
I solved it by using indicies instead, that way I got around the borrow checker.
I used a separate vector when I first solved it, but wanted to try out this solution as well.
Using indices worked, thank you!
OK, so I’m thinking…
The error says I can’t combine immutable and mutable in the same function. I guess this makes sense, and that it’s because I’m not allowed to mutate an object while accessing it.
Is this a correct understanding of the error, or is there anything I can do to use this approach?
Thanks, I tried that. But now I get the error.
cannot borrow cards
as mutable because it is also borrowed as immutable
Thank you. I made the change suggested below to the linked one, but it still fails with the error.
cannot borrow cards
as mutable because it is also borrowed as immutable
No, that’s probably wrong.
I’ve just been trying different combinations of borrowing, but I can’t get it to works.
I’m pretty sure it’s the cards[id].copies += add
that is the cause of my issues.
I’m looking at the memory reported by metrics-server in EKS, as that what I base the container resource scaling on. Maybe the go process is reporting memory in a way that doesn’t represent the “actual” usage. But I’m not sure it matters here, unless I can get it to change the reported memory usage.
Please see the heap dump I added for 10000 devices. Reported memory is 1,1 GB.