Re: New & question
- Posted by Robert Craig <rds at EMAIL.MSN.COM> Nov 10, 1998
- 619 views
Rolf Schroeder writes: > I found once a subroutine from Rob (bytes_needed) from > wich I concluded that the sequence s defined by > sequence s > s = repeat( 1.1, 1024) > occupies 16 * 1024 bytes = 16 Kb (+ small overhead). > Is that really true? An atom has an accuracy of 8 bytes, > I would expect only 8Kb (+ small overhead) therefor. s will occupy roughly 4 * 1024 = 4 Kb plus the space for *one* floating-point atom. Why 4 *? Because s will consist of 1024 4-byte pointers (32-bit addresses) to a single shared floating-point number (1.1) in memory. repeat() will always set up shared pointers to the f.p. atom or sequence that is repeated. In general, floating-point atoms take more than 8 bytes, because they also include a 4-byte reference count field, plus 4-bytes for storage allocation overhead. bytes_needed() assumes that no sharing takes place, which is often wrong. Regards, Rob Craig Rapid Deployment Software http://members.aol.com/FilesEu/