lua-users home
lua-l archive

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


On 02/01/2014 17.37, Jerome Vuarand wrote:
Are you sure you ran the test using Lua 5.2? I did and here are my results:

initial state: 24.2 KB
allocated a large string: 1000.7 KB
assigned the same string: 1000.7 KB
allocated another, different, large string: 1977.3 KB
constructed a large string identical to an existing string: 2953.9 KB
deleted all strings: 24.1 KB

As expected by the change in 5.2, the re-creation of a string
identical to an existing one increase memory usage by one megabyte,
contrary to your results.

Interesting. I wondered why it stayed the same, after Roberto's remark, but I put it down to my ignorance. I tested with 5.2.0, though (invoked through a .bat file under Windows XP):

---------------------------------------------------
C:\E\programmi\vari\lua string example>lua52 -v
Lua 5.2.0  Copyright (C) 1994-2011 Lua.org, PUC-Rio

C:\E\programmi\vari\lua string example>lua52 stringexp.lua
initial state: 15.0 KB
allocated a large string: 991.6 KB
assigned the same string: 991.6 KB
allocated another, different, large string: 1968.2 KB
constructed a large string identical to an existing string: 1968.2 KB
deleted all strings: 15.0 KB
---------------------------------------------------

I just re-downloaded 5.2.0 and 5.2.1 from LuaBinaries: the change seems to have been introduced in 5.2.1.

If so (apologies for my short memory), maybe the page at http://www.lua.org/versions.html is a bit too terse.

--
  Enrico