-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmem_check.lua
More file actions
38 lines (28 loc) · 865 Bytes
/
mem_check.lua
File metadata and controls
38 lines (28 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
leveldb = require 'leveldb'
db = leveldb.new('./tmp')
print('version: ' .. db.version .. "\n")
counter = 0
while true do
db:get('k1')
db:get('k2')
db:get('unset_key')
db:set('k1', tostring(os.time()))
db:set('k2', tostring(os.time()))
db:set('k3', tostring(os.time()))
db:batchSet({k1 = tostring(os.time()), k2 = '321321', k4 = '111', k5 = '222'})
db:batchSet({k1 = tostring(os.time()), k2 = '321321', k4 = '111', k5 = '222'})
db:batchSet({k1 = tostring(os.time()), k2 = '321321', k4 = '111', k5 = '222'})
db:del('k1')
db:del('k2')
db:del('k3')
db:batchDel({'k4', 'k5', 'k6'})
db:batchDel({'k4', 'k5', 'k6'})
db:batchDel({'k4', 'k5', 'k6'})
counter = counter + 15
io.write("\r - " .. counter .. ' - ')
if counter % 100000 == 0 then
print("\n" .. collectgarbage('count') .. "\n")
end
end
print('close')
db:close()