Re: A non-sucking garbage collector
"Mark Hahn" <[email protected]> Mon, 19 Jul 2004 00:27:10 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
I know you are all probably getting really tired of reading my posts about this thing (or skipping over my posts), but I'm just having too much fun not to share this stuff. Using this new garbage collector means replacing the whole memory allocation scheme, the malloc/free/realloc. I have just started changing my code and I'm very pleased with how easy the new scheme is to use. Believe it or not you never have to call free or realloc. Because the copying GC goes through and copies the good stuff and leaves everything else behind, there is no need to explicitly free anything. Also when you want to reallocate something you just do a new malloc and forget the old allocation so there is no realloc either. The malloc call is extremely fast also. It just keeps one free pointer in a big pre-malloc'd arena and marches through giving out memory chunks of any size without keeping track of anything. This all only applies to objects and their data of course, but "everything is an object". This is soooo cool....