-
Content Count
3514 -
Joined
-
Last visited
-
Days Won
174
Posts posted by David Heffernan
-
-
2 hours ago, David Heffernan said:I mean, you could do this
"this" is the IDE enhancement you propose
-
Who ever works on a program without knowing what the main form is?
I mean, you could do this but would it bring significant benefit? Would it make developers more productive? I can't see it.
-
Without knowing what types you are using we can only guess what you are doing.
-
More details please. What is the error? What is TArray? I expect that it is your own type because the type defined in the RTL of that name is not an array, it's just a collection of static methods.
-
Actually, I am probably misleading you here. OTL needs a message loop which isn't there. I'm sure you can run one but it doesn't come for free in a blank console app.
Sorry!
-
FWIW, the repro could quite readily be expressed as a console app. It's worth learning how to do that because those apps are much simpler to share, being just a single file.
-
{$POINTERMATH ON} would be preferable, so avoiding the static array type
-
10 minutes ago, TurboMagic said:I would also expect that they are reported to me and in other big applications I have they actually are, but not in this one and reducing this might not be so easy.
@Attila: what in my finalization sections could trigger a silend exit process? Do y<ou have any examples so I know what to look for?
Calls to ExitProcess or TerminateProcess.
My experience however is that guesswork is not much of a basic for solving problems. My experience is that debugging is way more effective. My advice is that you debug your problem. Cutting down to a minimal reproduction is one way to start doing that.
-
9 hours ago, TurboMagic said:Ahem, the following code I had used to test will leak:
var
sl : TStringList;
begin
sl := TStringList.Create;
sl.Add('This will leak David!');
sl.Add('This will leak David!');
end;
See: no free, thus it will leak at least one TStringList.
I had even put that construct into the dpr and put an exit after the last Add call, so the application quit immediately. But it didn't show any message box.
Ok, doing that in the dpr and thus not running any VCL initialisation made in the dpr's main code migt be problematic for showing a message box,
but the code above was in the FormClose event of the main form and got called!Those are reported as leaks for me. As I said, we need a minimal reproduction.
-
Leak reporting works fine. I guess your code doesn't have a leak. Throw in a call to GetMem and see how that goes.
-
Leak reporting works. If you want help, make a minimal reproduction, and post it here.
-
Nothing has gone wrong with FastMM and memory leak reporting works fine.
-
Works fine in any context. If you notice though, I supplied a complete program. You only supplied snippets, the latest of which does not compile. Perhaps if you want help finding the bug in your code you could supply a complete but minimal reproduction, just as I did. Then it would be simple for us to find the mistake.
-
Works fine here. I wrote a version with the threading removed to make it simpler to understand.
{$APPTYPE CONSOLE} uses System.SysUtils; function CaptureValue(Value: Integer): TProc; begin Result := procedure begin Writeln(Value); end; end; procedure Main; var i, j: Integer; Procs: TArray<TProc>; begin SetLength(Procs, 10); for i := 0 to 9 do Procs[i] := procedure begin Writeln(i); end; for j := 0 to 9 do Procs[j](); for i := 0 to 9 do Procs[i] := CaptureValue(i); for j := 0 to 9 do Procs[j](); end; begin Main; Readln; end.
Output is
10 10 10 10 10 10 10 10 10 10 0 1 2 3 4 5 6 7 8 9
-
You have captured the variable. But you need to capture the value. Capturing the value is not supported directly so you need to fake that by making a copy of the variable into a new value, one per task.
More detail here
http://docwiki.embarcadero.com/RADStudio/en/Anonymous_Methods_in_Delphi
- 1
-
Ugh. Good luck reasoning about the security of such a thing.
-
You probably need to hook at the other processes. Not easy, and likely to be extremely brittle. Also won't work for any programs that do system menus in a non standard way.
-
58 minutes ago, OmahaMax said:Yes, it is a simple TStringList. However, when the output is posted in the final inserter stage, the inserted output matches the stringlist results. One thread works, two threads fail to process the first input, three threads fail to process the first two inputs, and so forth. Results are the same with or without logging.
Would be easier for people to help if you could post a minimal repro.
-
1 hour ago, Steve Maughan said:Hi Stefan,
Each item's value changes slightly on each iteration. Note also, finding the min item may take more than one comparison per change (if the min item's value changes such that it's not now the min item).
Thanks,
Steve
On each iteration, each value is modified. So, during the iteration, just keep track of the smallest value that you have seen to date.
-
Build the ISO 4217 table into your code and lookup the currency code from the country code.
-
3 hours ago, WillH said:No, that is the device that measures mileage
-
No English speaker I know, here in the UK, would say anything other than mileage.
This is one of those words whose meaning is now detached from its etymology.
- 2
- 1
-
1 hour ago, Lars Fosdal said:Depends on the dictionary, I guess.
Race conditions rarely flag as errors, but cause inconsistent or erratic data, possibly leading to wrongful processing later on.
In this case, at least one of the four parties would be denied access (due to exclusive write lock and - depending on the programmmer - exclusive read) to the file and hence should have/raise awareness of a problem.
But, whatever.
Well, there are plenty of types for which races lead to errors. But how races manifest is not part of what defines them. A race is simply unserialised access to a shared resource. There aren't multiple definitions of this term.
-
This is the dictionary definition of a race
- 1
Marking of the main form in a multiform VCL Application
in Delphi IDE and APIs
Posted
In English we use "you" and "one" interchangeably. I didn't mean you personally I meant that it could be done by someone. So it would have been clearer if I had said "one could do this".