-1

I'm facing an issue where instead of Dephi 11 generate Access violation when it should, it's freezing with high CPU usage and the only thing i can do is to force close the app process.

To simulate this issue i can use this code :

var test : array[1..2] of tstringlist;
begin
showmessage(test[2].Text);
end;

Of course i know this is a bugged code and it should thrown an Access violation as test[2] does not exists. But what happens is a freeze and here is what task manager shows : Delphi's process hangs on 100% of one core cpu.

Why this happens ? Is it a Delphi bug ?

enter image description here

delphirules
  • 6,443
  • 17
  • 59
  • 108
  • 2
    "and it should thrown an Access violation as test[2] does not exists" No, that's wrong. You can never rely on this. The typical thing that happens is that you cause memory corruption (without realising it!), causing the app to malfunction a day later in a completely unrelated part of it (maybe the code that controls the patient's IV flow). Only if you are very lucky will the system detect the problem and give you an AV. – Andreas Rejbrand Feb 01 '22 at 13:10
  • Thanks for the info. My main issue was the freezing and i didn't know what is happening... now i know it was a bug on my code that generated an AV , but was freezing due the configuration on Navive OS Exceptions. That's tricky... – delphirules Feb 01 '22 at 13:11

1 Answers1

0

I could find out what is happening. On 'Native OS Exceptions', i don't know why, the Access violation was configured like this :

enter image description here

Once i change like the below image, the issue is fixed.

enter image description here

delphirules
  • 6,443
  • 17
  • 59
  • 108