[gambit-list] Does "time" report an accurate count of the number of bytes allocated?
Bradley Lucier
lucier at math.purdue.edu
Fri Dec 21 00:50:22 EST 2012
On my 64-bit Mac, I get
> (time (##make-vector 8))
(time (##make-vector 8))
0 ms real time
0 ms cpu time (0 user, 0 system)
no collections
144 bytes allocated
1 minor fault
no major faults
#(0 0 0 0 0 0 0 0)
I'd figure this allocates only 8 (header) + 8 (words) * 8 (bytes/word) = 72 bytes, but time is reporting 144.
Similarly (and what led me to this),
> (time (##bignum.make 2 #f #f))
(time (##bignum.make 2 #f #f))
0 ms real time
0 ms cpu time (0 user, 0 system)
no collections
48 bytes allocated
no minor faults
no major faults
(don't do this at home!), which I expect allocates 8 (header) + 2 (adigits) * 8 (bytes/adigit) = 24 bytes.
What am I not understanding?
More generally, can the number of bytes reported be confused by stack manipulation? I.e., if things go on the stack, but then the stack is unwound, does "time" report any allocation?
Thanks.
Brad
More information about the Gambit-list
mailing list