Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/24/19 in all areas

  1. Uwe Raabe

    Debugger in 10.3.3 is useless :'(

    Can you attach a small example showing the problem? Just to rule out it is somehow bound to your system only? That would also be helpful for a bug report.
  2. Dalija Prasnikar

    Delphi 10.3.3 has been released

    @Erix A. @PeterPanettone @Darian Miller I haven't used ISO for a while... but Delphi updates (including web installer) always required complete uninstall and reinstall procedure. You can only use Modify/Repair if you are modifying or repairing with the same installer you originally installed. If that is 10.3.2, then you can only use it for modifying 10.3.2 features. There is a migration tool installed, accessible from Windows Start Menu that can be used for importing/exporting settings between various versions. But migration tool needs to be run before uninstalling. Also it is a bit flaky and not all settings are properly migrated. ISO installer had option to keep registry settings and that part worked better.
  3. Pawel Piotrowski

    Changing label text in thread leads to weird display

    not at all. Delphi Strings are NOT thread Safe. You need to use a CriticalSection or similar. see here: https://stackoverflow.com/questions/30412147/it-is-safe-to-change-variable-values-of-a-thread-from-the-main-thread http://blog.synopse.info/post/2011/08/28/Multi-threading-and-Delphi
  4. Pawel Piotrowski

    Changing label text in thread leads to weird display

    For a Delphi string, it's never threadsafe if you have one thread writing and one thread reading. What is safe is the reference counting of strings. Copy-On-Write of Delphi strings is not a threadsafe operation. if you need a multithreaded read/write access to the same string you generally should use some synchronization, otherwise you are potentially in trouble. Example of what could happen without any lock. String is being written: it should become bigger than it was, so new memory is allocated. But pointer is not yet modified, it points to old string. At the same time reading thread got a pointer and began to read old string. Context switched again to writing thread. It changed pointer, so now it is valid. Old string got refcount 0 and was immediately freed. Context switch again: reading thread continues to process old string, but now it is access to deallocated memory which may easily result in access violation. dummzeuch is correct. Usually, you do not need to worry, Delphi plays nice and takes care for you. But if you want to know why non aligned memory access is not atomic, here is why: The problem is not limited to CPU instructions. In fact it has more to do with the data bus. When you have a 32 bit wide data bus, a read from memory is aligned on that boundary. So if you were to perform a 32 bit read from address 0x02, then two memory cycles are required, a read from address 0x00 to get two of the bytes and a read from 0x04 to get the other two bytes. You see, the first read fetches all 4 bytes from the address 0x00, discards the first 2 bytes. The second read fetches all 4 bytes from 0x04, and similar discards the second two bytes. After that the remaining bytes are combined to give you your 32bit data that you requested. This is not guaranteed to be atomic. A different CPU core could get its chance in between the above two reads to change the memory at address at 0x04, just before you read it. This is why you can not assume atomicity with non aligned variables. You might get lucky, because the CPU has multiple caches, and it might happen to be safe. But it is not guaranteed to be atomic. On a similar note, aligned memory is twice as fast to read/write, and this is why Delphi (and other compilers) align instructions and data in memory. I've build a small test, to see, how the following record will be aligned: Just for fun. TmyNiceRecord = Record i1: Integer; i64: int64; b1, b2, b3: byte; w1, w2: word; b4: byte; i2: Integer; b5: byte; b6: byte; b7: byte; End; who can guess which fields are aligned properly? Which are guaranteed to be atomic? Here are the results: for win32 build, with delphi 10.3.2 Address*| Aligned | VarName | VarSize 0 | Yes | i1 | 4 8 | Yes | i64 | 8 16 | Yes | b1 | 1 17 | No | b2 | 1 18 | No | b3 | 1 20 | Yes | w1 | 2 22 | No | w2 | 2 24 | Yes | b4 | 1 28 | Yes | i2 | 4 32 | Yes | b5 | 1 33 | No | b6 | 1 34 | No | b7 | 1 (* as an offset to the record itself) For win64 Address | Aligned | VarName | VarSize 0 | Yes | i1 | 4 8 | Yes | i64 | 8 16 | Yes | b1 | 1 17 | No | b2 | 1 18 | No | b3 | 1 20 | Yes | w1 | 2 22 | No | w2 | 2 24 | Yes | b4 | 1 28 | Yes | i2 | 4 32 | Yes | b5 | 1 33 | No | b6 | 1 34 | No | b7 | 1 interesting, isn't it? So, is delphi playing nice? Which fields can be assumed to be atomic? The answer is: All of them. Even b2 and b3. Yes, they do not start with a aligned address, but they do not cross the boundary either. This means, the read/write is still atomic. I hope that helps to better understand the topic. MemoryAlignedOrNot.zip
  5. Uwe Raabe

    Delphi 10.3.3 has been released

    That's one reason why I don't work with packages installed by GetIt. Despite some efforts since the first appearance, it is still a half baked solution and not suitable for my environment and the way I work.
  6. Dave Nottage

    Anyone successsful with 64bit Android Debugging?

    Thanks.. I've added my devices to the list.
  7. Mark Williams

    Finalization section not called unless main form shown

    VCL The form creation code is in the proj file. You can't assign the form as the main form other than in project options. It's readonly. Which has made me realise I don't have a mainform. Maybe that's the problem
  8. Dalija Prasnikar

    Anyone successsful with 64bit Android Debugging?

    Android 64bit debugging has issues on some devices. Debugging 64 bit Android application hangs the IDE https://quality.embarcadero.com/browse/RSP-26704 Can you please add information about your device - model and Android version to the above bug report.
  9. Attila Kovacs

    Finalization section not called unless main form shown

    I'm not sure what your "exit" does, and I can't see your code, but with the code below finalization is called: if not DoLogIn() then begin Application.ShowMainForm := False; Application.Terminate; Application.Run; end;
  10. Silver Black

    Delphi 10.3.3 has been released

    For previous new versions, I always run the Web Installer, then it offers to uninstall the previous version of the software and ask me if mantain the registry keys. I always answer "yes" I everything runs smoothly: I have the new version instralled and all my settings preserved.
  11. Clément

    Debugger in 10.3.3 is useless :'(

    I completely remove 10.3 (Clean all registry et al) and reinstalled it. I deleted all dsk, dcus, .local but still, no way to debug the DoInvoke. Truly disappointed. I guess I'll have to hunt down all RAD Studio entries in my registry to be able to uninstall it properly. And one weekend is completely lost
  12. PeterPanettone

    GExperts 1.3.15 experimental twm 2019-11-23 released

    I decided to give something back and to donate this professional icon exclusively for the standalone code formatter exe: (You can use it for the CodeFormatter Expert in GExperts too). If you like it you can use it: GExpertsFormatter_Icon.zip I have sent you the password for the ZIP archive in a PM.
  13. Yaron

    The 9 Hints in MARS

    After doing a clean install of Delphi 10.3.3, I had to re-install mars, so I did a zip download directly from GitHub and on a re-compile, it still shows 3 hints: [dcc32 Hint] MARS.Core.MessageBodyReaders.pas(302): H2443 Inline function 'TJSONArray.GetValue' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Core.MessageBodyReaders.pas(366): H2443 Inline function 'TJSONArray.GetValue' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Data.Utils.pas(213): H2443 Inline function 'TJSONArray.AddElement' has not been expanded because unit 'System.JSON' is not specified in USES list I of course fixed it myself in a few seconds, just an FYI.
  14. Uwe Raabe

    Debugger in 10.3.3 is useless :'(

    Perhaps it helps to delete the .dsk file of the project and/or project group.
  15. Dalija Prasnikar

    Delphi 10.3.3 has been released

    Reported as https://quality.embarcadero.com/browse/RSP-26321 somehow it was not Opened. I guess that IDE is fully functional only at 100% DPI. All other scaling settings are causing trouble.
  16. Ian Branch

    D10.3.3.3 & 64bit?

    Hi Team, Just installed D10.3.3 32 & 64 bit. Did have D10.3.2 32 bit installed. Never installed 64 bit before. Went to create a small 64bit project and there doesn't seem to be a 64bit option? If I look into the Tools|Options|Language|Delphi|Library I see Windows 64-bit as a selectable platform. Is there somewhere else I need to set to enable 64bit? Regards & TIA, Ian
  17. David Heffernan

    THttpServer port number...

    This is certainly a thing that is routinely done. https://en.m.wikipedia.org/wiki/Ephemeral_port The system has support for generating such ports, I've used it with an Indy server listening on loopback for a client in the same process. I do this to implement an application help browser using an embedded Web browser control. I don't want to use a fixed port number because I don't want to risk clashing with other services. And since I control both server and client an ephemeral port is perfect.
  18. Dalija Prasnikar

    Delphi 10.3.3 has been released

    The best options would be opening the installation support ticket https://www.embarcadero.com/support But AFAIK support only works Monday-Friday I just found someone had similar issue (read the comments) http://blog.marcocantu.com/blog/2019-november-delphi-10-3-3-available.html full Uninstall/Reinstall helped in that case. Maybe try installation without adding Microsoft SDK. Or try using the web install if downloading is not a problem for you. I am sorry that I cannot be of more help, but the last ISO installer I used was for XE4.
  19. PeterPanettone

    Delphi 10.3.3 has been released

    After having uninstalled 10.3 (with the option to keep the registry settings), I started the ISO setup. But at the end of the ISO setup installation again no bds.exe has been created!!! Also, at the end of the ISO setup there was a promise to install the Microsoft SDK: But nothing happened after clicking the Finish button! What now?
  20. PeterPanettone

    Delphi 10.3.3 has been released

    These are the settings from the setup program: According to these settings, the setup program should install RAD Studio. What kind of "setup" program is this? PS: BTW, although I have selected English as the setup language, you can see that parts of the installer instructions are in German. What kind of installer is this? I am really pi**ed off!
  21. Pawel Piotrowski

    Changing label text in thread leads to weird display

    Of course it wont be atomic! There is a very very important rule besides the size. A variable must be aligned by 32bit boundaries. on x86systems , a 32-bit mov instruction is atomic if the memory operand is naturally aligned, but non-atomic otherwise. In other words, atomicity is only guaranteed when the 32-bit integer is located at an address which is an exact multiple of 4. That rule is true on all modern x86, x64, Itanium, SPARC, ARM and PowerPC processors: plain 32-bit integer assignment is atomic as long as the target variable is naturally aligned. Which the integer in your packed record will most likely not be. - unless... it is part of an other record, that has 3 byte fields before your packed record 😉 So to assume atomicity, you need to know where your variable is placed in the memory... Your record may be safe anyway - but by luck not by design - because there is something like a CPU cache line. The CPU has some cache and that one is locked too, so the multiple cores can not access it simultaneously... see here for more details, I'm not an expert on that: http://delphitools.info/2011/11/30/fixing-tcriticalsection/ To sum up, use TInterlocked to access simple types if you are not 100% sure they will be naturally aligned.
  22. Pawel Piotrowski

    Changing label text in thread leads to weird display

    First things first, what you describe is not read only. When a thread writes and an other thread reads, then you need to protect the variable. Always. OK, almost always. There are types that are guaranteed to have atomic read write operations (see comments above). So they are protected by the CPU. Anyway, you need to be aware of this, even if you do not need to protect the variable yourself. And you need to double check the architecture of the device your code will run on. I would say, all of them should have the same rules regarding atomic read write operations... but... In case of strings. Protect them. See here for a topic on why: http://codeverge.com/embarcadero.delphi.general/strings-thread-safety/1051533 itself is not.
  23. Pawel Piotrowski

    Changing label text in thread leads to weird display

    My advice would be the same. Stay away from TThread.Synchronize calls if possible. Instead, either call TThread.Queue - that works a bit better. or even better, have a shared variable, in which the thread writes the current step. In the main GUI thread have a timer, and read out that same variable and update the label there. And don't forget to protect that shared variable with a critical section or similar.
  24. https://eurekalog.blogspot.com/2019/11/black-friday-and-cyber-monday-sale-2019.html If you deploy Windows apps to clients, tools like Eurekalog and MadExcept are indispensable for information about what goes wrong and where, when your users get an unhandled exception. Disclaimers: We use Eurekalog. We do not get referral discounts.
  25. My preferred way of dealing with sub-tasks is to provide a "mailbox" i.e. some sort of container, like a queue, array or list, for them to insert their results in. The main thread can either poll the mailbox periodically, or you could use a message or signal to initiate the polling whenever the container has content added.
×