RE: Just say 'YES' to strings
- Posted by "Kat" <gertie at visionsix.com> Jun 03, 2004
- 398 views
On 3 Jun 2004, at 9:47, Al Getz wrote: > > Hi there Kat, > > I had a feeling someone was going to bring up Unicode strings> Of course to handle that there would have to at least be a > second 'type' such as C_UCSTRING (in addition to C_STRING). > > Not sure what you meant about the garbage collection though, > maybe you could explain a little more? tia
Garbage collection is a operation where data stored in memory is rearranged to close up small holes of unused memory, so as to open up larger more usable holes. The more items pointing to a certian location, the more must be updated for each move. Just considering that more than one variable might point there take a little time. (That the other item may be a different type is immaterial tho, even if by some fluke the type is checked just because it's repointed during the gc.) If the gc is interrupted and 2nd item is accessed before it's updated, it most likely contains garbage. Threads or other processes that share var memory would barf on that problem. On the other paw, there's two time savings that can be realised: 1) when accessing the data, a single var can be looked up instead of stepping thru nested layers in the primary var,, 2) only one set of data needs moving in the actual gc. Keep in mind most languages give you no control of when the gc operation occurs, how much time is spent on it, if it is interruptable, what memory to relocate to (making it a sorta-combined-clean-up-and-move operation), or what vars to clean and which you know have not been accessed and to not clean. (Some gc copy every var at least once, and if you have 10,000 vars, call a func() that uses 50 of them intensely, why gc all 10,000 of them,,, just call gc at the end of that func(), thereby resetting the gc interval.... it can actually save time when used properly, in some situations, ymmv.) Anyhow, there's whole listservs devoted to garbage collection, ask David Cuny.
Kat