-
Content Count
277 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Jacek Laskowski
-
Experience/opinions on FastMM5
Jacek Laskowski replied to Leif Uneus's topic in RTL and Delphi Object Pascal
I've got a callstack in FastMM4 set to 25, because that's the value that didn't cut off my log. -
Experience/opinions on FastMM5
Jacek Laskowski replied to Leif Uneus's topic in RTL and Delphi Object Pascal
Adjustable with source change? -
Experience/opinions on FastMM5
Jacek Laskowski replied to Leif Uneus's topic in RTL and Delphi Object Pascal
@Primož Gabrijelčič I know that, but changing sources to imho is not a configuration 🙂 It should be in the file FastMM4Options.inc -
Experience/opinions on FastMM5
Jacek Laskowski replied to Leif Uneus's topic in RTL and Delphi Object Pascal
@Pierre le Riche How deep is the call stack in FastMM5 reports? In FastMM4 it was hardcoded to 11, I reported an issue to add a depth setting option, but it was not added. -
Maybe @jbg know trick to permanently enable this feature in editor?
-
Try to work with JS in the VSC editor, you will quickly change your mind.
-
It just handles, only in specific situations, so I asked if it could be switched on permanently. I discovered it by accident, it only works if the text is a commentary and only if there is some unicode character pasted in the same line, here unicode ENVELOPE.
-
Because the code looks better, neater and clearer. I use ligatures in VSC and I am a fan of them 🙂
-
I'm working with Delphi on a VMware machine, where I have a disk (with sources) connected from the host via "Folders sharing" mechanism. It's not too fast, but it usually works well. Sometimes Delphi can slow down a lot, e.g. I click the dot after the name of an object and wait a long time for a list of methods. So I fired a process manager called Process Hacker. And I watched what happens when Delphi "hangs and thinks". Here's the PH screenshot: It turned out that during the hanging, the I/O rate increases very much. But the Disk and Network ratios are not increasing. What could this I/O be?
-
Which drive? The system one in vm? The network one from the host? And how do you disable the cache?
-
FastMM5 now released by Pierre le Riche (small background story)
Jacek Laskowski replied to Günther Schoch's topic in Delphi Third-Party
I can't find a link to the FastMM4Options.inc file. Is FastMM5 no longer a configuration file? -
Issue with variant in record in array
Jacek Laskowski posted a topic in RTL and Delphi Object Pascal
Simple example: program leak; {$APPTYPE CONSOLE} {$R *.res} uses FastMM4, System.SysUtils; type TRx = record s : string; v : Variant; end; TAx = TArray<TRx>; procedure Test; var lA : TAx; begin SetLength(lA, 3); lA[0].s := 'test2'; lA[0].v := 888; lA[1].s := 'test1'; lA[1].v := Now; lA[2].s := 'test3'; lA[2].v := 'str'; end; begin try Test; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. When I don't assign TDateTime to a Variant field, the debugger shows the array and all records correctly, as in the picture on the left. And there is no leakage. But when I assign TDateTime type to Variant field, as on the right side of the picture, the debugger does not show "plus" in hint window and I get a memory leak at the end. What is wrong with this code? -
Issue with variant in record in array
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
In fact, when I'm not debuging, there is no leak. But is it an IDE error to show the record array (without the record expansion plus) in a hint debugger? Because I was afraid it was a problem in my record and array memory management. I do some tricks there. -
How to set the generic class field to the value provided by Variant? The following code is not compiled. ToField<T> = class private fData : T; protected procedure SetFromVariant<T>(const aValue : Variant); [...] procedure ToField<T>.SetFromVariant<T>(const aValue : Variant); var val: TValue; begin val := TValue.FromVariant(aValue); fData := val.AsType<T>; <=== [dcc32 Error] E2008 Incompatible types [dcc32 Error] E2008 Incompatible types
-
Variant to generic T, how?
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
@Remy Lebeau I cannot use this constraint because it blocks the use of string types (because it is not a valuable type). -
Variant to generic T, how?
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
@Remy Lebeau That's impossible, fData is generic: [dcc32 Error] E2010 Incompatible types: 'T' and 'Variant' -
I got a Chad Z. Hower article: https://www.codeproject.com/Articles/1252175/Fixing-Delphis-Interface-Limitations The author is very critical about the interfaces in Delphi. But he gives examples where he mixes interface and object access, which is doomed to failure in advance. I use interfaces very much, and I don't agree with the statement that there is more trouble with them than good. I don't know e.g. C++ and I don't know how interfaces are solved there, probably my ignorance limits my understanding of the problem. Can someone enlighten me if the interfaces in Delphi are really that badly done?
-
Variant to generic T, how?
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
I'm blind, sorry and thx! 🙂 -
Variant to generic T, how?
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
Your code is identical to mine, don't I notice anything? I still get compilation error on Delphi 10.3 -
The interfaces in Delphi are bad?
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
Very common, basically always, used database classes like TDataset, etc. I create in runtime, they are for example part of business classes, as "Owner" I give them nil. There I would like to use them in the interface model, not in the VCL management model. -
Do you name your Threads for debugging?
Jacek Laskowski replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
Unfortunatelly I don't. When it comes to the order of starting the "initialization" section it's not always the same, it all depends on the uses section, in my case your code is launched before RTL/VCL threads. I bypassed this problem by adding a anonymous thread with delay: procedure NameDelphiThreads(const pMainThreadId : THandle); begin TThread.CreateAnonymousThread( procedure var vSnapshot:THandle; vProcessId:THandle; vTE32:TThreadEntry32; i:Integer; begin Sleep(100); vProcessId := GetCurrentProcessId(); vSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, vProcessId); if vSnapshot <> INVALID_HANDLE_VALUE then begin [...] end; end ).Start; end; -
The interfaces in Delphi are bad?
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
But try this "trick" on TComponent or it's descendants... no way. -
Do you name your Threads for debugging?
Jacek Laskowski replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
@Darian Miller Your code starting with initialization is not perfect, because it fires up before all native threads are created. -
I'm looking for a library/class to minify (compress) HTML files. Is there such a thing?
-
You can: - delete end of lines (CR, CRLF) - delete spaces between fields in css: style="color: white; border: 5px" => style="color:white;border:5px" - delete all spaces and tabs of which there is more than one next to each other (except the <pre></pre> tag) - if the styles are defined within HTML in <style type="text/css"> then all long style names like bold_red_important_text can be replaced by short names