I have a sample go snippet which pulls 50k rows from source DB and inserts 
into target DB. https://go.dev/play/p/IVANZyVUbkm

While doing so I create a empty slice and add operations to it. When the 
length of slice is > 10K, I do a bulk write to DB.

The problem here is this script eats more memory as it runs, I suspect 
issue is with the slice which gets appended periodically. I try to do a 
copy as suggested in few articles and reset it but it never gives up on the 
memory and the script consumes more and more as it runs.

Any idea as to who to release the memory of slice every 10k docs ?

I have reset the slice, but memory is not returned back.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f13871ee-d421-4388-8e93-5e8bc379d29fn%40googlegroups.com.

Reply via email to