Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/24/20 in Posts

  1. What is GExperts? GExperts is a plugin for the Delphi IDE that adds many enhancements and also fixes some bugs. Which Delphi versions are supported? By the time of this writing GExperts supports Delphi 6 to 10.4 (with the exception of Delphi 8). GExperts releases always support/require the latest update for each Delphi version available at the time of the release. Where can download it? There is a link to downloads for the current and older releases on https://gexperts.dummzeuch.de I found a bug, what do I do? Please file a bug report. If you happen to have already fixed this bug, please also attach a patch or an archive with the changed source files. I have a brilliant idea for an improvement. What do I do? Please file a feature request. I have added some improvement to GExperts. Where can I submit it? Please also file a feature request and attach a patch or an archive with changed source files. Why shouldn't I report bugs an request features through this forum? I prefer to work on the actual program rather than being my own secretary. Taking posts from the forum and create the bug reports / feature requests is boring and time consuming work. I don’t want to do that work. Where is the source code? See compiling your own DLL. Why is GExperts still on SourceForge rather than on Github like all the other important projects? I happen to like SubVersion better than Git. Github does not support SubVersion (apart from a bridge with limited features). What if I have a question not covered in this list? There is a more comprehensive list of frequently asked questions on my homepage Additional questions can of course be asked in the forum.
  2. I was trying to run an example of wasteful, inefficient string manipulation to see what happens to memory consumption, without Fastmm. I expected the end result to be high memory consumption, de-fragmented, not leaving much free memory for project to use. But at the end of parsing the project uses almost the same system memory: Start: End: During the parsing the memory consumption is all over, the highest over 1GB: Here is example of string manipulation: uses StrUtils; const cLoop = 100; cMultiplyString = 100000; function MultiplyStr(aStr: string; aMultiplier: integer): string; var i: Integer; begin for i := 1 to aMultiplier do Result := Result + aStr; end; function Parse(aString: string): string; var s1, s2: string; i: Integer; begin s1 := MidStr(Copy(MidStr(aString, 1, Length(aString) - 2), 1, Length(aString) - 2), 10, Length(aString) div 2); for i := 1 to 100 do Delete(s1, 1, 1); s2 := s1 + s1; end; procedure TForm2.Button1Click(Sender: TObject); var s: string; i: integer; begin for i := 1 to cLoop do begin s := ''; s := Parse(MultiplyStr('STRING_TO_PARSE' + i.ToString, cMultiplyString)); end; end; Is Delphi's memory manager so good that even if the work is wasteful, inefficient string manipulation, when it ends it cleans up memory very well?
  3. Remy Lebeau

    Error is 10053 but StatusCode is 200

    By default, but that is not a requirement. You have to look at the response's Connection header to know for sure whether the server is leaving the connection open or not. If the connection is closed by the server, the response's Connection header will be set to "close", and the socket connection should be gracefully closed (but that depends on implementation) immediately after the last byte of the response has been sent. This kind of socket error can only happen if the client tries to read more bytes after the connection has been lost. Which means either the client is not detecting the end of the response correctly so it knows when to stop reading, or the server is not reporting the end of the response correctly. If the response's Content-Length header is missing, EOF is reported by socket connection closure (unless the response's Content-Type is a self-terminating media type, like MIME), so the server SHOULD close the connection gracefully, not abortively. If the Content-Length is present but has an invalid value, then the client may try to read more bytes than is actually being sent, which may lead to an abortive closure.
  4. Mike Torrettinni

    Example of wasteful, innefficient string manipulation

    Interesting! I just ran the same example in D2006 and result is almost the same, at the end of the parsing the memory comes down to almost as it was at the start. Peak memory consumption is very similar, around 1.1GB. I don't have D7 installed to try.
  5. Mahdi Safsafi

    Example of wasteful, innefficient string manipulation

    Mike, you should always rationalize your resource and don't let someone else do it for you (MM) because this can have a wide effect : - OS may start to page things. - All sort of thrashing issues (check the link). - Cache miss. - Performance penalty. - ...
  6. Mahdi Safsafi

    Example of wasteful, innefficient string manipulation

    When you ask for memory, MM(FastMM) asks the OS for a large chunks and then it splits them and gives you a piece (based on the size you need). When the object is destroyed (free), the memory is returned to the MM. Now, based on the returned size, the MM may either choose to recycle the object location (if its small) or return the memory to the OS (a real-free-op). What you're doing in MultiplyStr is not just wasteful but extremely harmful ! For each iteration you're reallocating memory. Allocating a new block and copying the old block to the new one. It's very important to know that small block are implemented as a segregated list. i.e if you ask for a 32 bytes, MM on reality allocates an entire table i.e 32x32=1024 bytes and yields first block. In your example you said you used 1GB ! this is extremely bad because you're not economizing resources and you'll quickly run out of memory i.e another thread that asks for a large chunk. It's indeed a good practice to pre-allocate memory : function MultiplyStr(aStr: string; aMultiplier: integer): string; var i: Integer; begin SetLength(Result, length(aStr) * aMultiplier); for i := 1 to aMultiplier do Result := Result + aStr; end; Please run the above and notice the memory and performance !!! Also a small remark ! aStr should be const !!!
  7. Alexander Elagin

    Example of wasteful, innefficient string manipulation

    If you want to get the most of FastMM (different configurations for debug/release, fine tuning of settings) you still need the standalone version. The bundled one is a "good middle ground" but there always are options to get more...
  8. Hello, here's a small Christmas present for you: There is a new release 6.0 of DEC - Delphi Encryption Compendium available, or put otherwise: DEC is back on track! 😉 The release can be found here: https://github.com/MHumm/DelphiEncry...eases/tag/V6.0 What is DEC? DEC is the Delphi Encryption Compendium open source library, a library containing cryptographic algorithms of the following categories: hash algorithms encryption algorithms key deviation functions CRC cryptographic pseudo random number generator format conversion classes What's new in V6.0 compared with the 5 year old V5.2 release? A complete list can be found in the last chapter of the included documentation. Supports D2009 - 10.4.1 Sydney Cross platform compatible if you turn off use of ASM in DECOptions.inc the hard to understand test program got reworked into unit tests test coverage got increased some bugfixes, like fixing the XTEA encryption algorithm or the included KDF2 turned out to be KDF1 instead implementation of the newest Whirlpool hash algorithm version implementation of KDF1, KDF2 and KDF3 key deviation algorithms changed unit structure to be more modular and better maintainable added some demo applications. The two FMX based ones are even available from Google Play (stemming from an earlier commit) added a 40+ A4 sized pages documentation most methods contain XMLDOC comments now So is it all over now, or are there plans for the future? Of course I know that this release didn't bring much new algorithms. But as far as my time allowes development shall continue (further project members are welcome!) I do have some plans for V6.1: Add the SHA224 hash, this is still missing Add SHA3 Add GCM block chaining mode for ciphers Add a first pasword hash algorithm, most likely bcrypt So much for today 😉 Cheers TurboMagic
  9. David Heffernan

    Example of wasteful, innefficient string manipulation

    Delphi's memory manager is fastmm. Also, your tool to measure the effect of the program isn't really telling you anything. It says nothing about fragmentation of address space. Virtual memory is a very complex subject. I suspect you need to learn more of the details before you can reason about your program.
  10. Dear visitors, I like to notify you that 35% discount is now available for our VCL component suite. Use CHRISTMAS coupon code when ordering. NextSuite includes always growing set of VCL components. Most important components are: NextGrid6 (StringGrid/ListView replacement, written from scratch). NextDBGrid6 (Db variant of the grid) NextInspector6 - An object inspector component.   and many more.  Few screenshots:      Download big demo project from: http://www.bergsoft.net/downloads/vcl/demos/nxsuite6_demo.zip  Website: www.bergsoft.net
  11. @Kas Ob. Cool idea ... I love it ! Although, this could be somehow challenging on x64 where data (variable that holds the pointer) could be located so far (exceeding 32-bit range) ... But I have a couple of ideas how to handle it ... Again thanks for the great idea 🙂
  12. Angus Robertson

    Error is 10053 but StatusCode is 200

    HTTP/1.1 keeps the connection open to handle repeated requests, so one request may work, then seconds later the connection is closed and you get an error without another request starting. How this is reported is down to the developer. Angus
  13. Fr0sT.Brutal

    Error is 10053 but StatusCode is 200

    Server has sent a response and broke the connection forcibly. I wouldn't bother as long as response being sent is complete
  14. pyscripter

    Images in High DPI, how?

    Fonts scale quite nicely. Font Awesome for example and the like are used in high DPI apps. Microsoft suggests the use of Segoe MDL2 Assets font for UWP applications (supports layering, colorization and mirroring).
  15. Rollo62

    Prefix unit local variable names

    I got used to use local variables, to decouple arguments to inject them into anonymous methods. Thats why I try always to use A...argument with according L...local E.g. procedure MyProc( const AArg : String ); var LArg : String; begin LArg := AArg; //<== I make a "copy" of the arguments, to inject them into async anon-procs CallAnonymousAsyncStuffHere( procedure begin use LArg; //<== LArg is injected here, and always referable in the anon proc end ); end; Since I do it like that, I have never encountered any issues with those anon-procs anymore, and readability is very good (for me). Thats why I try to use the same scheme now all the time, anon or not anon, as a valid pattern for me.
  16. FPiette

    ways to organize related code in a form?

    If you have circular reference, that means your frames don't properly expose their features. None of the frame should ever refer to the hosting form! None should ever know that thei are hosted by a form. The frame does his work and returns results back to the hosting form thru methods, properties and events. The components in the frame, making the UI, shall NEVER referenced directly from the outside (Consider those components as strict private). If they must get values from the outside, then properties shall be used for the purpose. Let's take a trivial example: Assume an application having to compute the sum of two numbers and display the result. You build a form having what is required to display the sum and use a frame to let the user input the numbers and compute the sum. The frame would expose properties for the numbers so that the form can initialize it for example from a configuration file having default values. If no initialization required, the form simply do not touch those properties. When the user enter numbers in the frame, code in the frame compute the sum, store the result in a property and trigger an OnSumAvailable event (A TNotifyEvent). The form assign an event handler to the frame OnSumAvailable and from that event handler read the frame property containing the sum and display where it has to be displayed. In that architecture, you have a object derived from TFrame which encapsulate a behavior (UI and computation) and expose properties and event to support the behavior (It could also contain methods) without any assumption about how it is used. There is NO reference in the frame to the rest of the application. The is NO circular reference. In that architecture, the frame don't know and don't care how the computed sum is displayed on the hosting from. And the form don't know and don't care host the numbers are entered by the user. If will have zero impact if the frame is updated to use a track bar to enter the number or simple TEdit and zero impact if the form display the result in TLabel or a fancy 7-digits display component.
  17. darnocian

    ANN: Sempare Template Engine for Delphi

    It is now available via GetIt as well
×