Skip to content

gc_cdatanum is counted improperly #5820

@Buristan

Description

@Buristan

Some kinds of cdata are counted improperly (i.e. are not counted).

How to reproduce:
Assume we have a file named <cdatanum.lua> with the following code:

local ffi = require "ffi"

local function collected() print"collected" end

collectgarbage()
print("before", misc.getmetrics().gc_cdatanum)
ffi.gc(ffi.cast("void *", 0), collected)
collectgarbage()
collectgarbage()
print("after", misc.getmetrics().gc_cdatanum)

Output:

$ src/luajit cdatanum.lua
before  0
collected
after   -1

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingluajit

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions