Jump to content

DelphiUdIT

Members
  • Content Count

    445
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by DelphiUdIT

  1. In Windows you can use the function " EmptyWorkingSet(GetCurrentProcess) " (from WinAPI.PsAPI) to release all memory to OS. I use it on my application when the memory used is over 50% of all system memory (this help also to reduce the effects of fragmentation). My applications use lot of images, near 2000 raw buffers / second (form some KB to some MB) and fragmentation is high. Every 4 / 5 days I look (from logs) that the application use that function. Normally the application stay on near one year, actively working 10 hours per day. You should look for equivalent function in Linux (I'm quite sure that should exists). Bye
  2. DelphiUdIT

    The function of EmptyWorkingSet

    You look this post with result ? There are simple memory non release to OS (paged, not paged, virtual, not virtual, ghost, not ghost, imaginary, not imaginary ...) and the acts like "cache". This memory will be releases directly by OS if it's needed. I simply forced that (there is not only EmptyWorkingSet APi but others that do the same) when the size of the WorkingSet is too high. That's all, really simple. No side effects (except for the first "round" of application where I have latency, OF COURSE). AND EmptyWorkingSet doesn't works (I means that the results are not constant) when there are leaks: I had done some tests with memory leaks, and the base memory, as expected, increased every time that a leak was generated. You can see it very well and is very clear with EmptyWorkingSet. EDIT: this is the only way I know, but like always I might miss something of course, to view a leaks "on the line" that you have, when using third-party libraries. If you don't have leaks, after three years (the "ancient" report with live application that I have) the base memory (simply measured after call the API) is exactly the same measured with byte precision. This is possible, I agreed with you: but until the next refactoring the things stay in this way. I promise that will do some tests to view if the conclusions are wrong, and report here that.
  3. DelphiUdIT

    The function of EmptyWorkingSet

    Like I wrote, I don't use swap file and I don't have any issues, except the performance (little loss). May be, with Windows 11 that is not a problem, but the software works perfectly in this way: next time that I'll refactor it I'll try to retest all.
  4. DelphiUdIT

    The function of EmptyWorkingSet

    The test were done some years ago, during the covid era (2020). I used two PCs with Windows 10, processor I7-10700 and I7-9700 at that time with 16 GB of DDR4 RAM. ALL TEST WERE DONE WITH 64 bit APP. I try test allocated stable memory and cache memory (or like you named it) allocated (and release) increased raw data (images) in a quickly way to stress the OS. This result was a variable size of working set, but the same sequence had done about the same results. I used only one file to load an image at the start of the program, after that only copy in memory was done and no activity on disk were done. With diagnostic and monitoring tools like those of "SysInternals" (I remember that I used RAMMAP, but also others that I don't have in mind now), I look for composition of working set. After that simple run a part of analysis (some functions of vision analysis that I normally use), of course repeated some millions time and catch the global time of these analysis. Note that these timing test were done after that the working set are big enough. The same analysis were done after using the EmptyWorkingSet and the timing were restores. The timing showed that with about 50% of memory used (eg. wotking set from API "GetProcessMemoryInfo") by the the program (or programs when external loads were used) compared to that present in the PC, the are some degradation (with peaks of 5%) and with more used memory 75% the peaks go to 10%. These was done with various mode: using the same application to allocate the memory and do tests, using external application to allocate the memory. The two PCs does different results of course, with smaller percentages of variations with I7-9700. During all these process Internet was disabled but Windows Defender was enabled. After those tests I never repeats them. EDIT: ... I talking about 200 ms of timing. One normal program cycle is from 90 ms. to 200 ms.
  5. DelphiUdIT

    Block Component Exit Event on Cancel?

    My uses are to do all controls at the exit of the dialogs. In that point I can control all (for example incompatibility between choose selection or settings, set value, etc ...) and report to user what he should do. I really don't know how to resolve your issue.
  6. DelphiUdIT

    The function of EmptyWorkingSet

    I understood like it works, and I described what happens ... but you don't have catch the problem and why I use it. I use it because when the memory "in use", "locked", "booked", "cached", or like you want to describe it, is too high there is performance degradation. (to respond to @David, i check normally the memory status, like temperature and others, and launch the function is two lines, of code: "if ... then Empty...." not so much time or energy spent) Why there is that degradation I don't know, but for sure is that when the memory .... is to high, using EmptyWorkingSet is useful. And this every 4 or 5 days ... I don't use it every single machine cycle. But if EmptyWorkingSet is so "objectless", why exists ? It may be that whoever created the automatic memory management also foreseen that perhaps this mechanism may not be infallible, and has given a tool to force "the hand". But all that (especially how I handle the lines) is not correlated with the original question of the topic, I'm OT so I suggest to start a new topic if needed. Bye P.S.: @Lars Fosdal or some moderators, move my posts and correlated to other new topic ... except for one or two, others are nothing to do with the original topics. Thanks
  7. DelphiUdIT

    The function of EmptyWorkingSet

    Like I told I don't use virtual memory on disk (it's disabled). And always like I told that function is called one time every 4 o 5 days ... in the PC run's only my software (and of course normal Windows services) and it's for this that cache memory become very high. I call the function when a memory occupation over 50% is detected and when the machine has the first functional stop. After that (always when the machine in in the stopped mode) a simulated run (one shot) is done to resolve the latency. All that is about 100 ms. (include one simulated round of application). The EmptyWorkSet doesn't discharge the memory pages onto disk, he release the memory to OS (from Application workspace to OS).
  8. DelphiUdIT

    The function of EmptyWorkingSet

    @Anders Melander I'm not completely in line with you. It's true that memory management is automatic and normally you don't have to worry about it, but have you ever tried to observe the performance of an application with more or less available memory (I'm talking about Windows)? I did in the past some tests using more or less memory, both "privately" allocated and used in cache, and performance drops in proportion to availability. Testing up to 40% of occupied memory there are no problems whatsoever but from 50% and above there are performance losses of 5% on average, from 75% I have detected performance losses of up to 10%. All analyzes were done using the exact same dataset (specifically images) and occupancy was simulated with both real occupancy and cached occupancy (approximately estimated), measuring average processing times. The memory occupation was carried out both inside the application and externally, and the two situations gave comparable results. There is no virtual disk memory in my systems, and no file operations were performed during testing. I use PC with 32GB memory and peak usage of 24GB is normal. The processor is normally used at around 75% and the CPU temperature varies between 75 and 85 degrees. I can assure you that without the use of the EmptyWorkingSet I would have to slow down the industrial line at peak times, obviously automatically and in real time (which is what I did in the past).
  9. DelphiUdIT

    The function of EmptyWorkingSet

    Yes, you're right. There is a little latency (in my application measured in 10 milliseconds near) when the program start again to works and use (allocate) memory. But whit this, I can maintain the memory free, especially when a lot of gigabytes are used. The last post is the example that also in Windows there is a memory that was not freed, like in Linux and in others OS probably, and using that API you can free memory (cache, but not only) if you need. And I think the should be a function in Linux too that can do this (although I don't know in depth the memory management system in Linux, so I might be talking nonsense).
  10. DelphiUdIT

    Memory not freed in Linux but freed in Windows

    This is with the use of EmptyWorkingSet ... the working set is the same value of used memory that TaskManager report ...
  11. DelphiUdIT

    Memory not freed in Linux but freed in Windows

    I don't know, I use a laptop with I7 12700H RAM DDR5.
  12. DelphiUdIT

    Memory not freed in Linux but freed in Windows

    Mine ...
  13. DelphiUdIT

    The function of EmptyWorkingSet

    I don't know how "working set" interact with memory (page, virtual, etc..) and standard FastMM, but the function is really working freeing memory not released. I used FastMM5 for test and not side effects will be notice. I tested also EmptyWorkingSet in leak condition and in this case the effects are near to NULL (only little parts of memory freed). Some links: https://learn.microsoft.com/en-us/windows/win32/memory/working-set https://learn.microsoft.com/en-us/windows/win32/psapi/working-set-information https://learn.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-emptyworkingset
  14. DelphiUdIT

    LOCKED FILE

    Other than Unlocker there is also a SysInternals utility that should do that, HANDLE: https://learn.microsoft.com/en-us/sysinternals/downloads/handle You can do some search to identify the Windows API that can release an handle: HANDLE of SysInternals use the PID of process to do this without close the thread or process the lock the file (or handle in general).
  15. It's more complex than this ... The wrapper (tlb) (it's the "ASCOM Device Interfaces for Platform 6") expose only the interfaces, there is a "scopeSim" that expose similar interface and a full class. He must explorer all type libraries registered about that (or read the full documentation) and find the class that use that interface (or how to use if it's exposed in the documentation or in the examples like @Anders told). Bye
  16. DelphiUdIT

    TIdHTTPWebBrokerBridge: Require TLS

    In the article that I signal in the last post there are also some suggestions to use only one port ... like you need.
  17. DelphiUdIT

    TIdHTTPWebBrokerBridge: Require TLS

    For me is working, but I have the github version of Indy (I don't think this change something). I think that the "socket" is still trying to use TLS for connection, but I'm not sure about that and I don't know how to help you. Look this article of @Remy Lebeau to redirect the connection from "http" to "https": https://www.atozed.com/forums/thread-367-post-834.html#pid834
  18. DelphiUdIT

    TLS v1.3

    In the Embarcadero release, Indy packages, components and other stuffs may be differ from GitHub maintained release. For example IndyIPServer, IndyIPClient and others are not present in the GitHub version. EDIT: also the runtime version may be differ like 12.0 and 12.1 where in the 12.1 release the new WIN64X "platform" exists.
  19. DelphiUdIT

    TIdHTTPWebBrokerBridge: Require TLS

    (This is for TIdHTTPServer component, hope to be useful for you component). You must use the "TIdSSLIOHandlerSocketBase.PassThrough" property ... if you set it to FALSE then TLS is required, if you set to TRUE only clear connection (NO TLS) are managed. Do it in the "create connection" event: procedure TForm1.Server1Connect(AContext: TIdContext); begin If AContext.Connection.IOHandler is TIdSSLIOHandlerSocketBase then TIdSSLIOHandlerSocketBase(AContext.Connection.IOHandler).PassThrough := false; //If True the authentication is not managed (only in clear text) or is used for STARTTLS, if false it manages the TLS/SSL authentication end;
  20. DelphiUdIT

    TComboBoxEx icon in editbox?

    EDIT: This is for TComboBox, I never used TComboBoxEx and I don't know if that I suggest is working with that component. You can use OnDrawItem to draw what you want this is an example that draw a flag (form an array of pngimages), you have to see if you can also use this method for the Edit position: //FlagListPNG is a list of pngimages //NameLangLisTXT is a list of string (name of the languages) //You must adapt of course at your use procedure TLanguageSelect.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); begin try TComboBox(Control).Canvas.Draw(Rect.Left + 8, Rect.Top + (Rect.Height div 2 - FlagListPNG[Index].Height div 2), FlagListPNG[Index]); TComboBox(Control).Canvas.TextOut(Rect.Left + 8 + FlagListPNG[Index].Width + 8, Rect.Top, NameLangListTXT[Index]+' '); except TComboBox(Control).Canvas.TextOut(Rect.Left + 10, Rect.Top, NameLangListTXT[Index]); end; end;
  21. If you only want to know if two buffer or strings are identical, you can use CompareMem (from System-Sysutils) : https://docwiki.embarcadero.com/Libraries/Athens/en/System.SysUtils.CompareMem Of course the size of the two blocks should be the same (to be identical 😉 ) .
  22. DelphiUdIT

    Delphi 12.1 is available

    For me is working for Win32 e Win64 project.
  23. DelphiUdIT

    boost in C++ Builder 12.1 Modern Compiler

    I think that was one question about, on which the organizer responded.
  24. DelphiUdIT

    boost in C++ Builder 12.1 Modern Compiler

    Somewhere I read that boost libraries will be release soon ... but I don't remember were I read this. EDIT: Uhmm, may be in the last webinar ....
  25. DelphiUdIT

    ICS V9.1 announced

    Go there and download (in the "Download OpenSSL Binaries" section) the release that you need: https://wiki.overbyte.eu/wiki/index.php/ICS_Download
×