[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: collectgarbage("count")
- From: Peter Cawley <lua@...>
- Date: Sat, 18 Jul 2009 19:35:52 +0100
On Sat, Jul 18, 2009 at 7:29 PM, František Fuka<fuka@fuxoft.cz> wrote:
> collectgarbage("count") should return "the total memory in use by Lua (in
> Kbytes)", which it does. But I am a little bit freaked out by the fact that
> it returns values like "17.6513671875", e.g. with precision higher than
> one-millionth of byte. Is this intentional and what exactly does it mean?
It's a result of converting the number to decimal.
17.6513671875 does not mean 17 Kb and 651.36... bytes, it means 17 Kb
and 65136/100000 of a Kb. However, as a Kb is 1024 bytes rather than
1000 bytes, a fraction Kb in base 10 will often look odd. If you
multiply the value by 1024, you get the byte count, which is a whole
number:
17.6513671875 * 1024 = 18075