On Friday, May 5, 2017 at 2:10:03 AM UTC+8, Jesper Louis Andersen wrote: > > To see why the "immediately" solution is not adequate: > > Step 1: Create a single linked list or a binary tree of a couple billion > elements. Make sure there is only a single reference to the head element. > Step 2: Release the pointer to the head > Step 3: Twiddle your thumbs while your program is blocked since all > elements needs to be immediately freed. >
No, "immediately freed" doesn't mean all unused memory blocks should be released by consuming all CPU. The unused memory blocks can be eventually collected by consuming a very small percentage of CPU. > > Alternative method: > > Moon instructs a student -- > > One day a student came to Moon and said: “I understand how to make a > better garbage collector. We must keep a reference count of the pointers to > each cons.” Moon patiently told the student the following story: “One day a > student came to Moon and said: ‘I understand how to make a better garbage > collector... > > > > On Thu, May 4, 2017 at 6:33 PM 'Axel Wagner' via golang-nuts < > golan...@googlegroups.com <javascript:>> wrote: > >> As so often is the question: Why? >> >> I don't believe this will ever be supported by gc; but if you think it's >> a good idea, you can of course do it and see whether it actually solves >> your problems (my prediction would be "there won't be a net change in >> problems", but am ready to be proven wrong). >> >> On Thu, May 4, 2017 at 6:00 PM, T L <tapi...@gmail.com <javascript:>> >> wrote: >> >>> sometimes, I really want to some memory blocks be collected when they >>> become unreferenced immediately.. >>> >>> -- >>> 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...@googlegroups.com <javascript:>. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> 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...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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. For more options, visit https://groups.google.com/d/optout.