[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: collectgarbage("count")
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Mon, 20 Jul 2009 10:30:13 +0200
2009/7/20 Jerome Vuarand <email@example.com>:
> 2009/7/18 Peter Cawley <firstname.lastname@example.org>:
>> On Sat, Jul 18, 2009 at 7:29 PM, František Fuka<email@example.com> 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
>> 17.6513671875 * 1024 = 18075
> IMHO it would feel more natural if the returned value was in kiB
> rather than in kB. It would preserve byte precision for much bigger
Forget about my previous email, I just realized the value is actually
expressed in kiBs.