Jump to content

Jacek Laskowski

Members
  • Content Count

    277
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Jacek Laskowski

  1. Jacek Laskowski

    Experience/opinions on FastMM5

    I've got a callstack in FastMM4 set to 25, because that's the value that didn't cut off my log.
  2. Jacek Laskowski

    Experience/opinions on FastMM5

    Adjustable with source change?
  3. Jacek Laskowski

    Experience/opinions on FastMM5

    @Primož Gabrijelčič I know that, but changing sources to imho is not a configuration 🙂 It should be in the file FastMM4Options.inc
  4. Jacek Laskowski

    Experience/opinions on FastMM5

    @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.
  5. Jacek Laskowski

    Fonts & ligatures

    Maybe @jbg know trick to permanently enable this feature in editor?
  6. Jacek Laskowski

    Fonts & ligatures

    Try to work with JS in the VSC editor, you will quickly change your mind.
  7. Jacek Laskowski

    Fonts & ligatures

    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.
  8. Jacek Laskowski

    Fonts & ligatures

    Because the code looks better, neater and clearer. I use ligatures in VSC and I am a fan of them 🙂
  9. Jacek Laskowski

    Slow IDE

    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?
  10. Jacek Laskowski

    Slow IDE

    Which drive? The system one in vm? The network one from the host? And how do you disable the cache?
  11. Jacek Laskowski

    FastMM5 now released by Pierre le Riche (small background story)

    I can't find a link to the FastMM4Options.inc file. Is FastMM5 no longer a configuration file?
  12. 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?
  13. Jacek Laskowski

    Issue with variant in record in array

    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.
  14. 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
  15. Jacek Laskowski

    Variant to generic T, how?

    @Remy Lebeau I cannot use this constraint because it blocks the use of string types (because it is not a valuable type).
  16. Jacek Laskowski

    Variant to generic T, how?

    @Remy Lebeau That's impossible, fData is generic: [dcc32 Error] E2010 Incompatible types: 'T' and 'Variant'
  17. 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?
  18. Jacek Laskowski

    Variant to generic T, how?

    I'm blind, sorry and thx! 🙂
  19. Jacek Laskowski

    Variant to generic T, how?

    Your code is identical to mine, don't I notice anything? I still get compilation error on Delphi 10.3
  20. Jacek Laskowski

    The interfaces in Delphi are bad?

    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.
  21. Jacek Laskowski

    Do you name your Threads for debugging?

    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;
  22. Jacek Laskowski

    The interfaces in Delphi are bad?

    But try this "trick" on TComponent or it's descendants... no way.
  23. Jacek Laskowski

    Do you name your Threads for debugging?

    @Darian Miller Your code starting with initialization is not perfect, because it fires up before all native threads are created.
  24. Jacek Laskowski

    Minifing HTML

    I'm looking for a library/class to minify (compress) HTML files. Is there such a thing?
  25. Jacek Laskowski

    Minifing HTML

    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
×