For example
\attribute1=1
\directlua{
for i = 1, 1000 do
tex.attribute[1] = i
local n = node.new('glyph')
node.set_attribute(n, 2, 1)
node.free(n)
end
print(status.node_mem_usage)
}
\bye
in 059eb3a40c10c79bd153530ea6fff236e43b2722 there was another
commented version that seems to work okay.
One small behavior change: node.current_attr() returns the cache list without taking a reference. If Lua code is holding that list when a node using it gets set_attribute, with the patch the held list shows the node's change, where before it stayed as it was. node.current_attr() is documented as a query, and freeing a node already freed this list in the same way, so I don't expect this to matter.
I attached a patch.
Udi