lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




Le ven. 10 déc. 2021 à 10:37, Roberto Ierusalimschy <roberto@inf.puc-rio.br> a écrit :
> My reply was about Roberto's suggestion to "forbid any GC operation while
> running
> a finalizer"
> If GC inside a finalizer is disabled, then simple operation "t.x=1" might
> raise OOM.

Did anyone in this discussion bother to see how Lua is today?  Run
the following program in any version of Lua since 5.2:

setmetatable({}, {__gc = function ()
  for i = 1, 1e8 do
    if i % 1e6 == 0 then
      print(collectgarbage("count") * 1024)
    end
    local a = {}
  end
end})

collectgarbage()
print("ok")


-- Roberto


with the latest hererocks (https://github.com/luarocks/hererocks/blob/master/hererocks.py),
it is an easy job to test in all version of Lua

```
local base = 'ALL_VERSION'
local script = 'gc.lua'

local version = {
--    '5.1.0', '5.1.1', '5.1.2', '5.1.3', '5.1.4', '5.1.5',
    '5.2.0', '5.2.1', '5.2.2', '5.2.3', '5.2.4',
    '5.3.0', '5.3.1', '5.3.2', '5.3.3', '5.3.4', '5.3.5', '5.3.6',
    '5.4.0', '5.4.1', '5.4.2', '5.4.3',
}

-- [[
for i = 1, #version do
    local cmd = 'python3 hererocks.py ' .. base ..  '/' .. version[i] .. ' --lua ' .. version[i] .. ' --no-readline'
    print(cmd)
    os.execute(cmd)
end
--]]

for i = 1, #version do
    local cmd = base ..  '/' .. version[i] .. '/bin/lua -v ' .. script
    print(os.execute(cmd))
end
```

see below the output from my box (Linux Ubuntu)

François


Lua 5.2.0  Copyright (C) 1994-2011 Lua.org, PUC-Rio
64024244
128024357
192024391
256024425
320024459
384024493
448024527
512024561
576024595
640024629
704024663
768024697
832024731
896024765
960024799
1024024833
1088024868
1152024903
1216024938
1280024973
1344025008
1408025043
1472025078
1536025113
1600025148
1664025183
1728025218
1792025253
1856025288
1920025323
1984025358
2048025393
2112025428
2176025463
2240025498
2304025533
2368025568
2432025603
2496025638
2560025673
2624027756
2688027791
2752027826
2816027861
2880027896
2944027931
3008027966
3072028001
3136028036
3200028071
3264028106
3328028141
3392028176
3456028211
3520028246
3584028281
3648028316
3712028351
3776028386
3840028421
3904028456
3968028491
4032028526
4096028561
4160028596
4224028631
4288028666
4352028701
4416028736
Killed
nil exit 137
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
64024330
128024443
192024477
256024511
320024545
384024579
448024613
512024647
576024681
640024715
704024749
768024783
832024817
896024851
960024885
1024024919
1088024954
1152024989
1216025024
1280025059
1344025094
1408025129
1472025164
1536025199
1600025234
1664025269
1728025304
1792025339
1856025374
1920025409
1984025444
2048025479
2112025514
2176025549
2240025584
2304025619
2368025654
2432025689
2496025724
2560025759
2624025794
2688025829
2752027912
2816027947
2880027982
2944028017
3008028052
3072028087
3136028122
3200028157
3264028192
3328028227
3392028262
3456028297
3520028332
3584028367
3648028402
3712028437
3776028472
3840028507
3904028542
3968028577
4032028612
4096028647
4160028682
4224028717
4288028752
4352028787
4416028822
Killed
nil exit 137
Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
64024266
128024379
192024413
256024447
320024481
384024515
448024549
512024583
576024617
640024651
704024685
768024719
832024753
896024787
960024821
1024024855
1088024890
1152024925
1216024960
1280024995
1344025030
1408025065
1472025100
1536025135
1600025170
1664025205
1728025240
1792025275
1856025310
1920025345
1984025380
2048025415
2112025450
2176025485
2240025520
2304025555
2368025590
2432025625
2496025660
2560025695
2624025730
2688025765
2752027848
2816027883
2880027918
2944027953
3008027988
3072028023
3136028058
3200028093
3264028128
3328028163
3392028198
3456028233
3520028268
3584028303
3648028338
3712028373
3776028408
3840028443
3904028478
3968028513
4032028548
4096028583
4160028618
4224028653
4288028688
4352028723
4416028758
Killed
nil exit 137
Lua 5.2.3  Copyright (C) 1994-2013 Lua.org, PUC-Rio
64024266
128024379
192024413
256024447
320024481
384024515
448024549
512024583
576024617
640024651
704024685
768024719
832024753
896024787
960024821
1024024855
1088024890
1152024925
1216024960
1280024995
1344025030
1408025065
1472025100
1536025135
1600025170
1664025205
1728025240
1792025275
1856025310
1920025345
1984025380
2048025415
2112025450
2176025485
2240025520
2304025555
2368025590
2432025625
2496025660
2560025695
2624025730
2688025765
2752027848
2816027883
2880027918
2944027953
3008027988
3072028023
3136028058
3200028093
3264028128
3328028163
3392028198
3456028233
3520028268
3584028303
3648028338
3712028373
3776028408
3840028443
3904028478
3968028513
4032028548
4096028583
4160028618
4224028653
4288028688
4352028723
4416028758
Killed
nil exit 137
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
56024106
112024219
168024253
224024287
280024321
336024355
392024389
448024423
504024457
560024491
616024525
672024559
728024593
784024627
840024661
896024695
952024729
1008024763
1064024798
1120024833
1176024868
1232024903
1288024938
1344024973
1400025008
1456025043
1512025078
1568025113
1624025148
1680025183
1736025218
1792025253
1848025288
1904025323
1960025358
2016025393
2072025428
2128025463
2184025498
2240025533
2296025568
2352025603
2408027686
2464027721
2520027756
2576027791
2632027826
2688027861
2744027896
2800027931
2856027966
2912028001
2968028036
3024028071
3080028106
3136028141
3192028176
3248028211
3304028246
3360028281
3416028316
3472028351
3528028386
3584028421
3640028456
3696028491
3752028526
3808028561
3864028596
3920028631
3976028666
4032028701
4088028736
4144028771
4200028806
4256028841
4312028876
4368028911
4424028946
4480028981
4536029016
4592029051
4648029086
4704029121
4760029156
4816029191
Killed
nil exit 137
Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
56026259.0
112026407.0
168026451.0
224026495.0
280026539.0
336026583.0
392026627.0
448026671.0
504026715.0
560026759.0
616026803.0
672026847.0
728026891.0
784026935.0
840026979.0
896027023.0
952027067.0
1008027111.0
1064027156.0
1120027201.0
1176027246.0
1232027291.0
1288029384.0
1344029429.0
1400029474.0
1456029519.0
1512029564.0
1568029609.0
1624029654.0
1680029699.0
1736029744.0
1792029789.0
1848029834.0
1904029879.0
1960029924.0
2016029969.0
2072030014.0
2128030059.0
2184030104.0
2240030149.0
2296030194.0
2352030239.0
2408030284.0
2464030329.0
2520030374.0
2576030419.0
2632030464.0
2688030509.0
2744030554.0
2800030599.0
2856030644.0
2912030689.0
2968030734.0
3024030779.0
3080030824.0
3136030869.0
3192030914.0
3248030959.0
3304031004.0
3360031049.0
3416031094.0
3472031139.0
3528031184.0
3584031229.0
3640031274.0
3696031319.0
3752031364.0
3808031409.0
3864031454.0
3920031499.0
3976031544.0
4032031589.0
4088031634.0
4144031679.0
4200031724.0
4256031769.0
4312031814.0
4368031859.0
4424031904.0
4480031949.0
4536031994.0
4592032039.0
4648032084.0
4704032129.0
4760032174.0
4816032219.0
Killed
nil exit 137
Lua 5.3.1  Copyright (C) 1994-2015 Lua.org, PUC-Rio
56025387.0
112025519.0
168025555.0
224025591.0
280025627.0
336025663.0
392025699.0
448025735.0
504025771.0
560025807.0
616025843.0
672025879.0
728025915.0
784025951.0
840025987.0
896026023.0
952026059.0
1008026095.0
1064026132.0
1120026169.0
1176026206.0
1232026243.0
1288028328.0
1344028365.0
1400028402.0
1456028439.0
1512028476.0
1568028513.0
1624028550.0
1680028587.0
1736028624.0
1792028661.0
1848028698.0
1904028735.0
1960028772.0
2016028809.0
2072028846.0
2128028883.0
2184028920.0
2240028957.0
2296028994.0
2352029031.0
2408029068.0
2464029105.0
2520029142.0
2576029179.0
2632029216.0
2688029253.0
2744029290.0
2800029327.0
2856029364.0
2912029401.0
2968029438.0
3024029475.0
3080029512.0
3136029549.0
3192029586.0
3248029623.0
3304029660.0
3360029697.0
3416029734.0
3472029771.0
3528029808.0
3584029845.0
3640029882.0
3696029919.0
3752029956.0
3808029993.0
3864030030.0
3920030067.0
3976030104.0
4032030141.0
4088030178.0
4144030215.0
4200030252.0
4256030289.0
4312030326.0
4368030363.0
4424030400.0
4480030437.0
4536030474.0
4592030511.0
4648030548.0
4704030585.0
4760030622.0
4816030659.0
Killed
nil exit 137
Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
56024892.0
112025024.0
168025060.0
224025096.0
280025132.0
336025168.0
392025204.0
448025240.0
504025276.0
560025312.0
616025348.0
672025384.0
728025420.0
784025456.0
840025492.0
896025528.0
952025564.0
1008025600.0
1064025637.0
1120025674.0
1176025711.0
1232025748.0
1288025785.0
1344025822.0
1400025859.0
1456025896.0
1512027981.0
1568028018.0
1624028055.0
1680028092.0
1736028129.0
1792028166.0
1848028203.0
1904028240.0
1960028277.0
2016028314.0
2072028351.0
2128028388.0
2184028425.0
2240028462.0
2296028499.0
2352028536.0
2408028573.0
2464028610.0
2520028647.0
2576028684.0
2632028721.0
2688028758.0
2744028795.0
2800028832.0
2856028869.0
2912028906.0
2968028943.0
3024028980.0
3080029017.0
3136029054.0
3192029091.0
3248029128.0
3304029165.0
3360029202.0
3416029239.0
3472029276.0
3528029313.0
3584029350.0
3640029387.0
3696029424.0
3752029461.0
3808029498.0
3864029535.0
3920029572.0
3976029609.0
4032029646.0
4088029683.0
4144029720.0
4200029757.0
4256029794.0
4312029831.0
4368029868.0
4424029905.0
4480029942.0
4536029979.0
4592030016.0
4648030053.0
4704030090.0
4760030127.0
4816030164.0
Killed
nil exit 137
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
56024332.0
112025120.0
168025156.0
224025192.0
280025228.0
336025264.0
392025300.0
448025336.0
504025372.0
560025408.0
616025444.0
672025480.0
728025516.0
784025552.0
840025588.0
896025624.0
952025660.0
1008025696.0
1064025733.0
1120025770.0
1176025807.0
1232025844.0
1288025881.0
1344025918.0
1400025955.0
1456025992.0
1512028077.0
1568028114.0
1624028151.0
1680028188.0
1736028225.0
1792028262.0
1848028299.0
1904028336.0
1960028373.0
2016028410.0
2072028447.0
2128028484.0
2184028521.0
2240028558.0
2296028595.0
2352028632.0
2408028669.0
2464028706.0
2520028743.0
2576028780.0
2632028817.0
2688028854.0
2744028891.0
2800028928.0
2856028965.0
2912029002.0
2968029039.0
3024029076.0
3080029113.0
3136029150.0
3192029187.0
3248029224.0
3304029261.0
3360029298.0
3416029335.0
3472029372.0
3528029409.0
3584029446.0
3640029483.0
3696029520.0
3752029557.0
3808029594.0
3864029631.0
3920029668.0
3976029705.0
4032029742.0
4088029779.0
4144029816.0
4200029853.0
4256029890.0
4312029927.0
4368029964.0
4424030001.0
4480030038.0
4536030075.0
4592030112.0
4648030149.0
4704030186.0
4760030223.0
4816030260.0
Killed
nil exit 137
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
56024332.0
112025120.0
168025156.0
224025192.0
280025228.0
336025264.0
392025300.0
448025336.0
504025372.0
560025408.0
616025444.0
672025480.0
728025516.0
784025552.0
840025588.0
896025624.0
952025660.0
1008025696.0
1064025733.0
1120025770.0
1176025807.0
1232025844.0
1288025881.0
1344025918.0
1400025955.0
1456025992.0
1512028077.0
1568028114.0
1624028151.0
1680028188.0
1736028225.0
1792028262.0
1848028299.0
1904028336.0
1960028373.0
2016028410.0
2072028447.0
2128028484.0
2184028521.0
2240028558.0
2296028595.0
2352028632.0
2408028669.0
2464028706.0
2520028743.0
2576028780.0
2632028817.0
2688028854.0
2744028891.0
2800028928.0
2856028965.0
2912029002.0
2968029039.0
3024029076.0
3080029113.0
3136029150.0
3192029187.0
3248029224.0
3304029261.0
3360029298.0
3416029335.0
3472029372.0
3528029409.0
3584029446.0
3640029483.0
3696029520.0
3752029557.0
3808029594.0
3864029631.0
3920029668.0
3976029705.0
4032029742.0
4088029779.0
4144029816.0
4200029853.0
4256029890.0
4312029927.0
4368029964.0
4424030001.0
4480030038.0
4536030075.0
4592030112.0
4648030149.0
4704030186.0
4760030223.0
4816030260.0
Killed
nil exit 137
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
56024892.0
112025024.0
168025060.0
224025096.0
280025132.0
336025168.0
392025204.0
448025240.0
504025276.0
560025312.0
616025348.0
672025384.0
728025420.0
784025456.0
840025492.0
896025528.0
952025564.0
1008025600.0
1064025637.0
1120025674.0
1176025711.0
1232025748.0
1288025785.0
1344025822.0
1400025859.0
1456025896.0
1512027981.0
1568028018.0
1624028055.0
1680028092.0
1736028129.0
1792028166.0
1848028203.0
1904028240.0
1960028277.0
2016028314.0
2072028351.0
2128028388.0
2184028425.0
2240028462.0
2296028499.0
2352028536.0
2408028573.0
2464028610.0
2520028647.0
2576028684.0
2632028721.0
2688028758.0
2744028795.0
2800028832.0
2856028869.0
2912028906.0
2968028943.0
3024028980.0
3080029017.0
3136029054.0
3192029091.0
3248029128.0
3304029165.0
3360029202.0
3416029239.0
3472029276.0
3528029313.0
3584029350.0
3640029387.0
3696029424.0
3752029461.0
3808029498.0
3864029535.0
3920029572.0
3976029609.0
4032029646.0
4088029683.0
4144029720.0
4200029757.0
4256029794.0
4312029831.0
4368029868.0
4424029905.0
4480029942.0
4536029979.0
4592030016.0
4648030053.0
4704030090.0
4760030127.0
4816030164.0
Killed
nil exit 137
Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio
56024892.0
112025024.0
168025060.0
224025096.0
280025132.0
336025168.0
392025204.0
448025240.0
504025276.0
560025312.0
616025348.0
672025384.0
728025420.0
784025456.0
840025492.0
896025528.0
952025564.0
1008025600.0
1064025637.0
1120025674.0
1176025711.0
1232025748.0
1288025785.0
1344025822.0
1400025859.0
1456025896.0
1512027981.0
1568028018.0
1624028055.0
1680028092.0
1736028129.0
1792028166.0
1848028203.0
1904028240.0
1960028277.0
2016028314.0
2072028351.0
2128028388.0
2184028425.0
2240028462.0
2296028499.0
2352028536.0
2408028573.0
2464028610.0
2520028647.0
2576028684.0
2632028721.0
2688028758.0
2744028795.0
2800028832.0
2856028869.0
2912028906.0
2968028943.0
3024028980.0
3080029017.0
3136029054.0
3192029091.0
3248029128.0
3304029165.0
3360029202.0
3416029239.0
3472029276.0
3528029313.0
3584029350.0
3640029387.0
3696029424.0
3752029461.0
3808029498.0
3864029535.0
3920029572.0
3976029609.0
4032029646.0
4088029683.0
4144029720.0
4200029757.0
4256029794.0
4312029831.0
4368029868.0
4424029905.0
4480029942.0
4536029979.0
4592030016.0
4648030053.0
4704030090.0
4760030127.0
4816030164.0
Killed
nil exit 137
Lua 5.4.0  Copyright (C) 1994-2020 Lua.org, PUC-Rio
56022537.0
112022572.0
168022608.0
224022644.0
280022680.0
336022716.0
392022752.0
448022788.0
504022824.0
560022860.0
616022896.0
672022932.0
728022968.0
784023004.0
840023040.0
896023076.0
952023112.0
1008023148.0
1064023185.0
1120023222.0
1176023259.0
1232023296.0
1288023333.0
1344023370.0
1400023407.0
1456023444.0
1512023481.0
1568023518.0
1624023555.0
1680023592.0
1736023629.0
1792023666.0
1848023703.0
1904023740.0
1960023777.0
2016023814.0
2072023851.0
2128023888.0
2184025973.0
2240026010.0
2296026047.0
2352026084.0
2408026121.0
2464026158.0
2520026195.0
2576026232.0
2632026269.0
2688026306.0
2744026343.0
2800026380.0
2856026417.0
2912026454.0
2968026491.0
3024026528.0
3080026565.0
3136026602.0
3192026639.0
3248026676.0
3304026713.0
3360026750.0
3416026787.0
3472026824.0
3528026861.0
3584026898.0
3640026935.0
3696026972.0
3752027009.0
3808027046.0
3864027083.0
3920027120.0
3976027157.0
4032027194.0
4088027231.0
4144027268.0
4200027305.0
4256027342.0
4312027379.0
4368027416.0
4424027453.0
4480027490.0
4536027527.0
4592027564.0
4648027601.0
4704027638.0
4760027675.0
4816027712.0
Killed
nil exit 137
Lua 5.4.1  Copyright (C) 1994-2020 Lua.org, PUC-Rio
56022729.0
112022764.0
168022800.0
224022836.0
280022872.0
336022908.0
392022944.0
448022980.0
504023016.0
560023052.0
616023088.0
672023124.0
728023160.0
784023196.0
840023232.0
896023268.0
952023304.0
1008023340.0
1064023377.0
1120023414.0
1176023451.0
1232023488.0
1288023525.0
1344023562.0
1400023599.0
1456023636.0
1512023673.0
1568023710.0
1624023747.0
1680023784.0
1736023821.0
1792023858.0
1848023895.0
1904023932.0
1960023969.0
2016024006.0
2072024043.0
2128024080.0
2184026165.0
2240026202.0
2296026239.0
2352026276.0
2408026313.0
2464026350.0
2520026387.0
2576026424.0
2632026461.0
2688026498.0
2744026535.0
2800026572.0
2856026609.0
2912026646.0
2968026683.0
3024026720.0
3080026757.0
3136026794.0
3192026831.0
3248026868.0
3304026905.0
3360026942.0
3416026979.0
3472027016.0
3528027053.0
3584027090.0
3640027127.0
3696027164.0
3752027201.0
3808027238.0
3864027275.0
3920027312.0
3976027349.0
4032027386.0
4088027423.0
4144027460.0
4200027497.0
4256027534.0
4312027571.0
4368027608.0
4424027645.0
4480027682.0
4536027719.0
4592027756.0
4648027793.0
4704027830.0
4760027867.0
4816027904.0
Killed
nil exit 137
Lua 5.4.2  Copyright (C) 1994-2020 Lua.org, PUC-Rio
56022093.0
112022128.0
168022164.0
224022200.0
280022236.0
336022272.0
392022308.0
448022344.0
504022380.0
560022416.0
616022452.0
672022488.0
728022524.0
784022560.0
840022596.0
896022632.0
952022668.0
1008022704.0
1064022741.0
1120022778.0
1176022815.0
1232022852.0
1288022889.0
1344022926.0
1400022963.0
1456023000.0
1512023037.0
1568023074.0
1624023111.0
1680023148.0
1736023185.0
1792023222.0
1848023259.0
1904023296.0
1960023333.0
2016023370.0
2072023407.0
2128023444.0
2184025529.0
2240025566.0
2296025603.0
2352025640.0
2408025677.0
2464025714.0
2520025751.0
2576025788.0
2632025825.0
2688025862.0
2744025899.0
2800025936.0
2856025973.0
2912026010.0
2968026047.0
3024026084.0
3080026121.0
3136026158.0
3192026195.0
3248026232.0
3304026269.0
3360026306.0
3416026343.0
3472026380.0
3528026417.0
3584026454.0
3640026491.0
3696026528.0
3752026565.0
3808026602.0
3864026639.0
3920026676.0
3976026713.0
4032026750.0
4088026787.0
4144026824.0
4200026861.0
4256026898.0
4312026935.0
4368026972.0
4424027009.0
4480027046.0
4536027083.0
4592027120.0
4648027157.0
4704027194.0
4760027231.0
4816027268.0
Killed
nil exit 137
Lua 5.4.3  Copyright (C) 1994-2021 Lua.org, PUC-Rio
56022101.0
112022136.0
168022172.0
224022208.0
280022244.0
336022280.0
392022316.0
448022352.0
504022388.0
560022424.0
616022460.0
672022496.0
728022532.0
784022568.0
840022604.0
896022640.0
952022676.0
1008022712.0
1064022749.0
1120022786.0
1176022823.0
1232022860.0
1288022897.0
1344022934.0
1400022971.0
1456023008.0
1512023045.0
1568023082.0
1624023119.0
1680023156.0
1736023193.0
1792023230.0
1848023267.0
1904023304.0
1960023341.0
2016023378.0
2072023415.0
2128023452.0
2184025537.0
2240025574.0
2296025611.0
2352025648.0
2408025685.0
2464025722.0
2520025759.0
2576025796.0
2632025833.0
2688025870.0
2744025907.0
2800025944.0
2856025981.0
2912026018.0
2968026055.0
3024026092.0
3080026129.0
3136026166.0
3192026203.0
3248026240.0
3304026277.0
3360026314.0
3416026351.0
3472026388.0
3528026425.0
3584026462.0
3640026499.0
3696026536.0
3752026573.0
3808026610.0
3864026647.0
3920026684.0
3976026721.0
4032026758.0
4088026795.0
4144026832.0
4200026869.0
4256026906.0
4312026943.0
4368026980.0
4424027017.0
4480027054.0
4536027091.0
4592027128.0
4648027165.0
4704027202.0
4760027239.0
4816027276.0
Killed
nil exit 137