Jump to content

Lars Fosdal

Administrators
  • Content Count

    3416
  • Joined

  • Last visited

  • Days Won

    113

Everything posted by Lars Fosdal

  1. Lars Fosdal

    Memory not freed in Linux but freed in Windows

    @michel.seicon In theory, it could be related to Ref. https://stackoverflow.com/questions/48651432/glibc-application-holding-onto-unused-memory-until-just-before-exit Delphi memory manager on Linux wraps malloc, so the question then becomes - is it possible to invoke malloc_trim from Delphi for Linux? I suggest you clean up the test program to run correctly, and report it at https://qp.embarcadero.com with a proper description of the differences in behavior. That way we might get some information from EMBT.
  2. Lars Fosdal

    hourglass and freezing problem with Firedac

    It is compatible with all MS SQL servers. Currently using the same FireDAC integration with 2008, 2012, 2016,2017 and 2019. How do you parameterize your connection? Have you double checked that your query doesn't pull back a massive amount of data? Check the FireDAC Monitor to see if it offers any clues. Which driver are you using? I recommend using the ODBC drivers. class function TPSDFireDatabasePoolMSSQL.FindBestDriver(const Link: TFDPhysMSSQLDriverLink): String; const // Constants copied from implementation section of FireDAC.Phys.MSSQL C_SQL_SERVER = 'SQL Server'; // DO NOT TRANSLATE C_2019_ODBC = 'ODBC DRIVER 19 FOR SQL SERVER'; // DO NOT TRANSLATE C_2018_ODBC = 'ODBC DRIVER 18 FOR SQL SERVER'; // DO NOT TRANSLATE C_2017_ODBC = 'ODBC DRIVER 17 FOR SQL SERVER'; // DO NOT TRANSLATE C_2016_ODBC = 'ODBC DRIVER 13 FOR SQL SERVER'; // DO NOT TRANSLATE C_2012_ODBC = 'ODBC DRIVER 11 FOR SQL SERVER'; // DO NOT TRANSLATE {$IFDEF POSIX} C_FreeTDS = 'FreeTDS'; // DO NOT TRANSLATE {$ENDIF} {$IFDEF MSWINDOWS} C_2012_NC = 'SQL SERVER NATIVE CLIENT 11.0'; // DO NOT TRANSLATE {$ENDIF} var DriverList : TStringList; WantedList : TArray<String>; Driver: string; begin Result := ''; // Blank = Default WantedList := {$IFDEF MSWINDOWS} {$IFDEF SQLNative} [C_2012_NC, C_2017_ODBC, C_2016_ODBC, C_2012_ODBC] {$ELSE} [C_2018_ODBC, C_2017_ODBC, C_2016_ODBC, C_2012_NC, C_2012_ODBC] {$ENDIF} {$ENDIF} {$IFDEF POSIX} [C_2018_ODBC, C_2017_ODBC, C_2016_ODBC, C_2012_ODBC, C_FreeTDS] {$ENDIF}; DriverList := TStringList.Create; try Link.GetDrivers(DriverList); DebugOut('Available SQL drivers'); // DO NOT TRANSLATE for Driver in DriverList do DebugOut(' "' + Driver + '"'); for var Wanted in WantedList do for Driver in DriverList do begin if CompareText(Wanted , Driver) = 0 then begin DebugOut('Selected driver: "' + Driver + '"'); // DO NOT TRANSLATE BestDriver := Driver; Exit(Driver); end; end; finally DriverList.Free; end; end;
  3. Lars Fosdal

    Memory not freed in Linux but freed in Windows

    It was Eurekalog. 32-bit 64-bit Lenovo P16 Processor 12th Gen Intel(R) Core(TM) i7-12850HX, 2100 Mhz, 16 Core(s), 24 Logical Processor(s)
  4. Lars Fosdal

    Memory not freed in Linux but freed in Windows

    That is weird! Maybe it is EurekaLog?
  5. Lars Fosdal

    Memory not freed in Linux but freed in Windows

    Another artifact I find alarming: change it to a Windows 64-bit build, and the performance drops like a rock. 32-bit (around 6k ms) 64-bit (around 34k ms per loop)
  6. Lars Fosdal

    The function of EmptyWorkingSet

    A workaround could be to explicitly allocate system memory outside of the regular memory manager, but that would require using specific methods for each platform. How does that work with memory allocations in FastMM?
  7. Lars Fosdal

    Memory not freed in Linux but freed in Windows

    The while true causes an infinte loop, which doesn't do anything but looping and sleeping after the first run, so why this can't run for days and days witout running out of memory, is a bit of a mystery. How do you monitor the memory usage? Building these fairly large strings will have the MemoryManager allocate memory blocks which will remain allocated (and reusable) after you free your classes. These will be allocated from system memory until the application exits. In some corner cases, you can have memory fragmentation, which is caused by the elements in the list of released blocks of memory, being to small to be reused to hold the new objects, but in you example, that is not the issue. The line TListaString(V_Listas[0]).V_String := ''; is not necessary, as the string type is reference counted and automatically will be released. Apart from that, I guess there is a point to why you are NOT using TStringList, but using other containers and methods in classes to encapsulate reused code, could greatly reduce the amount of code duplication - which again reduces the potential for errors. See System.Contnrs TObjectList and System.Generics.Collections TObjectList for examples of lists that can manage your objects. Tip - For the purpose of testing, you would want each time you test to be identical - hence setting RandSeed to a fixed value at the start will ensure you have repeatable execution.
  8. Lars Fosdal

    Possible Delphi 12.1 inheritance bug, could someone test also

    Did you try with a new .dproj file?
  9. Lars Fosdal

    A gem from the past (Goto)

    I still have a Memotech MTX512 in storage 🙂
  10. Lars Fosdal

    Delphi and "Use only memory safe languages"

    They kept start index 1 to stay compatible with the short strings. At some point it might be desirable to change it, but ... well... Bye bye backwards compatibility.
  11. Lars Fosdal

    ActionList Editor: New Standard Action...

    The new QP doesn't support voting and I cannot see a benefit in sharing this. Well, sharing allows discovery, and those that are affected can add a comment?
  12. Replace the brackets with parenthesis?
  13. Lars Fosdal

    ActionList Editor: New Standard Action...

    Try something else, then decide. Only you know what you need.
  14. Lars Fosdal

    ActionList Editor: New Standard Action...

    Stay on topic, please.
  15. Lars Fosdal

    Parameter passing

    Which language Which version Which class is SslHttpRest, and from which unit? If you use System.Net.HttpClient (which I use, because getting the REST classes to work with various flavours of OAuth2 turned out to be a challenge), you can do it something like this (code is not complete 😞 var HTTPRequest: IHttpRequest; // from System.Net.HttpClient HttpResponse: IHttpResponse; // System.Net.HttpClient ReqHeaders: TNetHeaders; // System.Net.URLClient URL: String; begin try try try HTTPRequest := HTTP.GetRequest('GET', URL); ReqHeaders := [ TNetHeader.Create('Content-Type', 'application/json'), TNetHeader.Create('Content-Length, ''), TNetHeader.Create('Store-Token', '22345673301244567896663456789012'), TNetHeader.Create('User-Agent', 'PostmanRuntime/7.37.3'), TNetHeader.Create('Accept', '*/*'), TNetHeader.Create('Postman-Token', '40f28212-2f71-487a-a22f-d6ecdfa61b8b'), TNetHeader.Create('Host', 'localhost:8080'), TNetHeader.Create('Accept-Encoding', 'gzip, deflate, br'), TNetHeader.Create('Connection', 'keep-alive') ]; HttpResponse := HTTP.Execute(HTTPRequest,nil, ReqHeaders); // HTTP is THTTPClient from System.Net.HttpClient ...
  16. If the date doesn't follow spec, do you really want to attempt to import it?
  17. Lars Fosdal

    RAD Studio 12.1 Athens Patch 1 Available

    RSS-425 doesn't open for me either. It could be that the reporter chose to NOT share the report with the Embarcadero Customer group.
  18. Lars Fosdal

    Delphi Low-code No-code?

    If you are a corporate developer, the money for tools are peanuts compare to other costs.
  19. Lars Fosdal

    Delphi and "Use only memory safe languages"

    Can we stay on the topic, please? Are there any practical languages that are applicable to writing the same variety of solutions as Delphi, that are actually memory safe? Even if you manage your memory in Delphi, it is not hard to get corrupted data due to a dangling or misdirected pointer, even in Delphi.
  20. Lars Fosdal

    TListview and TImage Pixalated Image

    Sometimes, when entering new areas of knowledge, you might not even know what to expect. Hence, a guiding hand can go a long way. Most people appreciate those that offer help without conditions.
  21. Lars Fosdal

    TListview and TImage Pixalated Image

    IMO, that was not very helpful. If you are a new user, you may need to be guided on how to do it right, not just be told that you are doing it wrong.
  22. Lars Fosdal

    Alexandria 11.3 and Android 13 (part 2)

    Irrelevant content removed.
  23. There also is https://docwiki.embarcadero.com/Libraries/Sydney/en/System.TypInfo.GetEnumProp which returns a PPropInfo, which again contains a PropType: PPTypeInfo, which you then can use with GetEnumValue?
  24. What if you treat every value as a generic type? That way you are free to use TypeInfo? procedure TParam<T>.SetAsString(const aValue: string); var TV: TValue; begin TV := TValue.From<T>(Default(T)); try case TV.Kind of tkEnumeration: TV := TValue.FromOrdinal(TypeInfo(T), GetEnumValue(TypeInfo(T), aValue)); tkInteger: TV := TValue.From<Integer>(StrToInt(aValue)); tkInt64: TV := TValue.From<Int64>(StrToInt(aValue)); tkFloat: TV := TValue.From<Extended>(StrToFloat(aValue)); else TV := TValue.From<String>(aValue); end; FValue := TV.AsType<T>; except on E:Exception do begin CmdDebugOut(Parent.Debug + ': "' + aValue + '" -> ' + E.Message); FValue := Default(T); end; end; end; function TParam<T>.GetAsString: string; var TV: TValue; begin TV := TValue.From<T>(FValue); Result := TV.AsString; end;
  25. @msohn - I don't usually spend much time in the text format .dfm.
×