

DelphiUdIT
Members-
Content Count
734 -
Joined
-
Last visited
-
Days Won
17
Everything posted by DelphiUdIT
-
To include Socket components, you must add component through menu "Component/Install Packages" and search at bin directory (like in the images). The socket package is deprecated, but it is still present.
-
Delphi 12.1 helps links to docwiki.embarcadero.com - no permission
DelphiUdIT replied to Gert Scholten's topic in Delphi IDE and APIs
-
Delphi MT940 implementation (reader, writer)
DelphiUdIT replied to Stéphane Wierzbicki's topic in Algorithms, Data Structures and Class Design
Nothing ... I was wrong -
New offline Help Athens 12.1 (May 2024)
DelphiUdIT posted a topic in Tips / Blogs / Tutorials / Videos
New offline helps for Rad Studio 12.1 Athens are published. https://docs.embarcadero.com/products/rad_studio/ -
I use simply this, limited to common standard system strings, of course this is a skeleton ... form the Main program you can use it in this way: TTraduzione.ChangeValues('IT'); unit uTraduzione; interface uses WinApi.Windows, System.SysUtils, Vcl.Consts; Type TTraduzione = Class public class procedure SetResourceString(const xOldResourceString: PResStringRec; const xValueChanged: PChar); public class procedure ChangeValues(Lingua: string = ''); End; implementation class procedure TTraduzione.SetResourceString(const xOldResourceString: PResStringRec; const xValueChanged: PChar); var POldProtect: DWORD; PLostProtect: DWORD; begin VirtualProtect(xOldResourceString, SizeOf(xOldResourceString^), PAGE_READWRITE, @POldProtect); xOldResourceString^.Identifier := NativeUInt(xValueChanged); VirtualProtect(xOldResourceString, SizeOf(xOldResourceString^), POldProtect, @PLostProtect); end; class procedure TTraduzione.ChangeValues(Lingua: string = ''); begin if Lingua = 'IT' then begin //Carica la lingua italiana SetResourceString(@SMsgDlgYes, '&Si'); SetResourceString(@SMsgDlgWarning,'Attenzione'); SetResourceString(@SMsgDlgError, 'Errore'); SetResourceString(@SMsgDlgInformation, 'Informazione'); SetResourceString(@SMsgDlgConfirm , 'Conferma'); SetResourceString(@SMsgDlgNo , '&No'); SetResourceString(@SMsgDlgOK , 'OK'); SetResourceString(@SMsgDlgCancel , 'Annulla'); SetResourceString(@SMsgDlgHelp , '&Aiuto'); SetResourceString(@SMsgDlgHelpHelp , 'Aiuto'); SetResourceString(@SMsgDlgHelpNone , 'Nessun aiuto disponibile'); SetResourceString(@SMsgDlgAbort , '&Termina'); SetResourceString(@SMsgDlgRetry , '&Riprova'); SetResourceString(@SMsgDlgIgnore , '&Ignora'); SetResourceString(@SMsgDlgAll , '&Tutto'); SetResourceString(@SMsgDlgNoToAll , 'N&o a Tutto'); SetResourceString(@SMsgDlgYesToAll , 'Si a &Tutto'); SetResourceString(@SMsgDlgClose , '&Chiudi'); end else if Lingua = 'EN' then begin //Carica la lingua inglese SetResourceString(@SMsgDlgYes, '&Yes'); SetResourceString(@SMsgDlgWarning,'Warning'); SetResourceString(@SMsgDlgError, 'Error'); SetResourceString(@SMsgDlgInformation, 'Information'); SetResourceString(@SMsgDlgConfirm , 'Confirm'); SetResourceString(@SMsgDlgNo , '&No'); SetResourceString(@SMsgDlgOK , 'OK'); SetResourceString(@SMsgDlgCancel , 'Cancel'); SetResourceString(@SMsgDlgHelp , '&Help'); SetResourceString(@SMsgDlgHelpHelp , 'Help'); SetResourceString(@SMsgDlgHelpNone , 'No Help Available'); SetResourceString(@SMsgDlgAbort , '&Abort'); SetResourceString(@SMsgDlgRetry , '&Retry'); SetResourceString(@SMsgDlgIgnore , '&Ignore'); SetResourceString(@SMsgDlgAll , '&All'); SetResourceString(@SMsgDlgNoToAll , 'N&o to All'); SetResourceString(@SMsgDlgYesToAll , 'Yes to &All'); SetResourceString(@SMsgDlgClose , '&Close'); end else if Lingua = 'ES' then begin //Carica la lingua spagnola SetResourceString(@SMsgDlgYes, '&Si'); SetResourceString(@SMsgDlgWarning,'Advertencia'); SetResourceString(@SMsgDlgError, 'Error'); SetResourceString(@SMsgDlgInformation, 'Información'); SetResourceString(@SMsgDlgConfirm , 'Confirmar'); SetResourceString(@SMsgDlgNo , '&No'); SetResourceString(@SMsgDlgOK , 'OK'); SetResourceString(@SMsgDlgCancel , 'Cancelar'); SetResourceString(@SMsgDlgHelp , '&Ayuda'); SetResourceString(@SMsgDlgHelpHelp , 'Ayuda'); SetResourceString(@SMsgDlgHelpNone , 'No hay ayuda disponible'); SetResourceString(@SMsgDlgAbort , '&Termina'); SetResourceString(@SMsgDlgRetry , 'Intentar &otra vez'); SetResourceString(@SMsgDlgIgnore , '&Ignorar'); SetResourceString(@SMsgDlgAll , '&Todos'); SetResourceString(@SMsgDlgNoToAll , 'N&o a todo'); SetResourceString(@SMsgDlgYesToAll , 'S&i a todo'); SetResourceString(@SMsgDlgClose , '&Cerrar'); end else begin .................... .................... .................... end; end;
-
https://blogs.embarcadero.com/powerful-advanced-hashing-library-for-delphi-windows-development/ XXHash32 and XXHash64 are there (github link inside), but not optimizing I think. I looked around some DLL AVX2 optimized with Delphi wrapper, but I don't remember where.
-
What do you think of "Local Global variables"
DelphiUdIT replied to Tommi Prami's topic in RTL and Delphi Object Pascal
I use nested methods when I have activities to carry out exclusively in that specific "section" of the program This also allows me to remind myself in the future that that type of operation only happens there. And the variables used are mostly just passed as parameters. Then it will be so simple and painless to eventually convert the nested method into a public/private method if needed. -
This is mine, same project of @vfbb but with 2 graphics surface from the same PC (always with vulkan enable): Intel Nvidia Intel: Intel(R) Iris(R) Xe Graphics Nvidia: NVIDIA GeForce RTX 3070 Ti Laptop GPU P.S.: Vulkan version 1.3.277
-
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
-
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.
-
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.
-
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.
-
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.
-
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
-
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).
-
@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).
-
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).
-
memory; Memory not freed in Linux but freed in Windows
DelphiUdIT replied to michel.seicon's topic in Cross-platform
This is with the use of EmptyWorkingSet ... the working set is the same value of used memory that TaskManager report ... -
memory; Memory not freed in Linux but freed in Windows
DelphiUdIT replied to michel.seicon's topic in Cross-platform
I don't know, I use a laptop with I7 12700H RAM DDR5. -
memory; Memory not freed in Linux but freed in Windows
DelphiUdIT replied to michel.seicon's topic in Cross-platform
Mine ... -
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
-
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).
-
Create a class that implements a DispInterface
DelphiUdIT replied to michastro's topic in Algorithms, Data Structures and Class Design
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 -
In the article that I signal in the last post there are also some suggestions to use only one port ... like you need.
-
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