Skip to content

Instantly share code, notes, and snippets.

@Shishqa
Created August 24, 2021 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shishqa/9753063a258e38520d3c2f09d18378a5 to your computer and use it in GitHub Desktop.
Save Shishqa/9753063a258e38520d3c2f09d18378a5 to your computer and use it in GitHub Desktop.
local table_new = require "table.new"
local function payload()
local _ = table_new(10, 0)
for i = 1, 10 do
_[i] = "memprof-str-"..i
end
_ = nil
collectgarbage()
end
-- 5 allocations from interp and 5 allocations
-- from the trace.
jit.opt.start(3, "hotloop=4")
jit.flush()
for _ = 1, 100500 do
payload()
-- Force JIT to regenerate the trace and create
-- new symtab entry.
jit.flush()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment