\let\3\relax
\directlua{
texio.write'\3'% Only to be escaped characters -> valgrind complains about write into unallocated memory
texio.write_nl''
for i=1,kpse.var_value'max_print_line'-3 do texio.write'.' end
texio.write'\3' % Here LuaTex writes 2 and not just 1 byte after it's allocated memory area
for i=1,kpse.var_value'max_print_line'-1 do texio.write'.' end
texio.write'\3' % The line break would fall inside of the escape sequence -> Line limit ignored
for i=1,2*kpse.var_value'max_print_line' do texio.write'.' end % This should normally not fit into one line
}
\bye
How do you run valgrind ? Which version ?
Do you compile luatex with standard -O2 ?
--