[SOLVED]till now, i have doubt on win10 of console application lazarus / 34-Windows ---------------------------------------------------------------------- powerpcer · 2021-05-26 14:32 when i make a console application on a win10, and run it inside CMD.exe on 2 PC, 1 with Anti-Virus  trend micro, other no Anti-Virus. they both has same problem, that's when i build my program, and type its name to run. most of time, it will run a part of code and then terminated on first run, when i run it more times, then it will run correctly. and i had put try catch to get exception message, but no exception generated. so it looks just run and terminated in half. but if i run in on LAZARUS IDE, it will always run correctly..... what a strange things. ---------------------------------------------------------------------- powerpcer · 2021-05-28 11:51 for example. second time is terminated unexpected. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i D:\APP\FPC component\WLF>WLF.exe -ser ofac "KORYO BONK"WLF start..WLF params readyWLF SEARCHLoadIndex:0Search:1TimerIdleTick: finished: 30ms D:\APP\FPC component\WLF>WLF.exe -ser ofac "KORYO BONK"WLF start..WLF params readyWLF SEARCH D:\APP\FPC component\WLF>  and look at my code below, if there is exception, i should catch, but no exception was catch, so strange!! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  etl:TETLName;  i,j:integer;  NTickInitial,NTickShowEnd: QWord;  p1:Puint32;  p:P2duint32;  params:array of string;  fname:string;  casevalue:Tparamvalue;  istack:TIStack; {$R *.res} begin  {istack:=TIStack.create(8);  for i:=1 to 8 do   istack.push(i);  istack.pop(j);  istack.pop(j);  for i:=9 to 15 do   istack.push(i);  while (istack.pop(j)) do  begin       writeln(stdout,j);  end;  exit;}  writeln(stdout,'WLF start..');  NTickInitial:= GetTickCount64;  fname:='ofac.txt';  casevalue:=DOETL;  if paramCount()>1 then  begin     setlength(params,paramCount());     for i := 1 to paramCount() do     begin          params[i-1]:= paramStr(i);     end;     if params[0]='-etl' then     begin        fname:=params[1];        casevalue:=DOETL;     end     else     if params[0]='-ser' then     begin        fname:=params[1];        casevalue:=SEARCH;     end     else     if params[0]='-pub' then     begin        fname:=params[1];        casevalue:=PUBLISH;     end     else     if params[0]='-peq' then     begin        fname:=params[1];        casevalue:=EQLIST;     end     else     if params[0]='-pew' then     begin        fname:=params[1];        casevalue:=EQWORD;     end     else     if params[0]='-pst' then     begin        fname:=params[1];        casevalue:=SETTINGLIST;     end     else     if params[0]='-dmp' then     begin        fname:=params[1];        casevalue:=DUMPINDEX;     end;     if params[0]='-brf' then     begin        fname:=params[1];        casevalue:=BRUTEFORCE;     end;  end;  writeln(stdout,'WLF params ready');  etl:=TETLName.create(fname);  try  case casevalue of       DOETL:         begin              writeln(stdout,'WLF DOETL');              i:=etl.startETL();            writeln(stdout,'startETL:'+inttostr(i));              i:=etl.GenerateIndex();              writeln(stdout,'GenerateIndex:'+inttostr(i));         end;       SEARCH:          begin              writeln(stdout,'WLF SEARCH');            i:=etl.LoadIndex(fname);              writeln(stdout,'LoadIndex:'+inttostr(i));              i:=etl.Search(params[2],3);              writeln(stdout,'Search:'+inttostr(i));         end;       DUMPINDEX:       begin              writeln(stdout,'WLF DUMPINDEX');            i:=etl.DumpIndex(fname);              writeln(stdout,'DumpIndex:'+inttostr(i));         end;       BRUTEFORCE:         begin             writeln(stdout,'WLF BRUTEFORCE');             i:=etl.LoadIndex(fname);             writeln(stdout,'LoadIndex:'+inttostr(i));             i:=etl.bruteforce(params[2],3);             writeln(stdout,'bruteforce:'+inttostr(i));         end;  end;  except    on E: Exception do    begin    writeln(stdout,'casevalue handling error occurred. Details: ', E.ClassName, '/', E.Message);    DumpExceptionCallStack(E);    end;  end;  etl.Free;  NTickShowEnd:= GetTickCount64;  writeln(StdOut,Format('TimerIdleTick: finished: %dms', [(NTickShowEnd-NTickInitial) div 10 * 10])); ---------------------------------------------------------------------- ASerge · 2021-05-28 18:00 These kinds of errors (unstable behavior) usually mean that an area of memory is being overwritten somewhere. Possible reasons: use of already freed memory, incorrect pointer dereferencing, etc. Obviously, the problem lies in this part of the code. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i        SEARCH:         begin              writeln(stdout,'WLF SEARCH');            i:=etl.LoadIndex(fname);              writeln(stdout,'LoadIndex:'+inttostr(i));              i:=etl.Search(params[2],3);              writeln(stdout,'Search:'+inttostr(i));         end;Since the snippet you attached doesn't reveal it, then either look for the error yourself, or show what these methods do and how. ---------------------------------------------------------------------- engkin · 2021-05-28 18:39 And for this instance, based on your screenshot, it *most likely* happened inside LoadIndex: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i            SEARCH:             begin                  writeln(stdout,'WLF SEARCH');                  i:=etl.LoadIndex(fname);                  writeln(stdout,'LoadIndex:'+inttostr(i));                  i:=etl.Search(params[2],3);                  writeln(stdout,'Search:'+inttostr(i));             end; ---------------------------------------------------------------------- powerpcer · 2021-05-29 01:30 Quote from: ASerge on May 28, 2021, 08:00:32 pmThese kinds of errors (unstable behavior) usually mean that an area of memory is being overwritten somewhere. Possible reasons: use of already freed memory, incorrect pointer dereferencing, etc. Obviously, the problem lies in this part of the code. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i        SEARCH:         begin              writeln(stdout,'WLF SEARCH');            i:=etl.LoadIndex(fname);              writeln(stdout,'LoadIndex:'+inttostr(i));              i:=etl.Search(params[2],3);              writeln(stdout,'Search:'+inttostr(i));         end;Since the snippet you attached doesn't reveal it, then either look for the error yourself, or show what these methods do and how. thanks, finally i found that FileRead(afile,buffer,4096); the "buffer" is pbyte, it will show unstable behavior, if change to array, it looks good.