All you are doing is replicating manual memory management. If you are going to do that just use CGo with malloc & free so you will have decent debugging.
If not, don’t do this at all and let the GC do its work (but Go lack of a generational GC might be an issue here). > On Jul 20, 2020, at 12:47 PM, Jan Mercl <0xj...@gmail.com> wrote: > > > Check https://godoc.org/modernc.org/memory, maybe it can be used in this > scenario. Note, using the package concurrently from multiple goroutines > requires coordination, like with a mutex. > >> On Mon, Jul 20, 2020, 19:35 <netconnect.m...@gmail.com> wrote: >> I have an application where I will be allocating millions of data >> structures, all of the same size. My program will need to run continuously >> and be pretty responsive to >> its network peers. >> >> The data is fairly static, once allocated it will rarely need to be modified >> or deleted. >> >> In order to minimize the garbage collection scanning overhead, I was >> thinking of allocating large blocks on the heap that were a fixed size that >> would hold 20K or so elements >> and then write a simple allocator to hand out pieces of those blocks when >> needed. Instead of having to scan millions of items on the heap, the GC >> would only be scanning 100 or so >> items. >> >> Sound reasonable? Or does this 'go' against the golang way of doing things? >> >> F >> -- >> 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/0be7d132-71d6-4ff9-a8eb-ca09a94fafeao%40googlegroups.com. > > -- > 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/CAA40n-Vn%2Bg8Yb9%3DX-K_95%3Dt6kQ3gr43kpj9JMwxRk3FMEv00Rw%40mail.gmail.com. -- 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/29FD40F9-DB62-4486-837C-70F0A9BD0BA1%40ix.netcom.com.