Skip to content

Conversation

zoon
Copy link

@zoon zoon commented Jul 14, 2025

Summary:
Both gcinfo() and collectgarbage("count") were returning truncated integer values instead of floating-point KB measurements, breaking compatibility with standard Lua implementations which preserve fractional bytes in their output.
Fixes #1917

Changes:

  • Modified gcinfo() and collectgarbage("count") to return full precision floating-point value
  • Updated return type from integer to double/number for both functions

Before:

  • gcinfo() -> 36 (integer)
  • collectgarbage("count") -> 36 (integer)

After:

  • gcinfo() -> 36.30859375 (double)
  • collectgarbage("count") -> 36.30859375 (double)
  • 1024 * 36.30859375 = 37180 (integer value in bytes)

…("count")

Both gcinfo() and collectgarbage("count") were returning truncated integer
values instead of floating-point KB measurements, breaking compatibility
with standard Lua implementations which preserve fractional bytes in their output.

Changes:
- Modified gcinfo() and collectgarbage("count") to return full precision floating-point value
- Updated return type from integer to double/number for both functions

Before:
- gcinfo() -> 36 (integer)
- collectgarbage("count") -> 36 (integer)

After:
- gcinfo() -> 36.30859375 (double)
- collectgarbage("count") -> 36.30859375 (double)
- 1024 * 36.30859375 = 37180 (integer value in bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

gcinfo() returns truncated memory usage in KB

1 participant