mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-27 09:40:12 +00:00
84d96e843c
The LuaStandalone interpreter needs to keep a mapping from integers returned to PHP to the corresponding function. But if it never releases these functions when PHP no longer has any reference to them, it can result in Lua running out of memory if a module with a large number of functions is invoked many times in one page. The fix here is to track which function ids are referenced from PHP, and periodically send the list to Lua so it can remove any that are no longer used from its cache. This also takes care of another issue where having multiple interpreter instances and passing function objects from one into another could call the wrong function in Lua. Bug: 51886 Change-Id: I4f15841051f7748d1d6df24080949e5cbd88f217
9 lines
190 B
Lua
9 lines
190 B
Lua
package.path = arg[1] .. '/engines/LuaStandalone/?.lua;' ..
|
|
arg[1] .. '/engines/LuaCommon/lualib/?.lua'
|
|
|
|
require('MWServer')
|
|
require('mw')
|
|
server = MWServer:new( arg[2] )
|
|
server:execute()
|
|
|