A.M. Hoornweg
Members-
Content Count
468 -
Joined
-
Last visited
-
Days Won
9
Everything posted by A.M. Hoornweg
-
One would only do this if one wants to convert floating point numbers to fixed point numbers. Fixed point numbers can be compared with exactness and there are use cases for that.
-
If the number of decimal places is not greater than 4, OP might consider using the currency data type. Currencies are exact fixed-point numbers having four decimals after the dot so a value like 1.015 can be stored with perfect precision. Adding, subtracting and comparing currencies always gives an exact result. Internally, they are 64-bit signed integers with an implicit divisor of 10,000. [edit] functions like "power" return a double or extended. Prior to comparing the results of such functions, store them in currencies.
-
Or write a tiny command line program that scans a dfm file and removes that property. Run that program prior to committing code to your source code repository. TortoiseSVN allows you to fully automate this by setting "hooks", I don't know about Git.
-
OP needs 300 billion bits or so he said. I assume that collecting that amount of data takes a long time and that the data will be evaluated to obtain some sort of useful result afterwards. So the program must run for a long time and may not be terminated prematurely or else the contents of the tBits are lost and everything has to start over again. That sounds like a very time consuming development/debugging cycle that can be avoided by splitting up the program into an acquisition process and an evaluation process that share a common block of virtual memory. The acquisition part can run "forever" in the background, it can be straightforward because it needs not evaluate the results. It just supplies live data (bits) in memory that become more complete over time. The evaluation part can be a work in progress that can be comfortably debugged, refined and re-compiled. It can observe "live" data that become more complete over time.
-
Sure. But OP has to re-write tBits anyway because of its size limitations. I'd advise him to make the allocation/deallocation methods virtual to keep all options open.
-
David, OP can just use whatever allocation method pleases him. The end result is a pointer to a memory block whatever method he uses. It doesn't make one version worse than the other.
-
In the simplest case a MMF is just a block of bytes, why would that be inappropriate? Just because it's allocated by a different API? We happen to use them extensively for data acquisition, they have that nice little feature that allows us to share the same buffer between processes. One process collecting data, another evaluating it. There are tons of use cases for that.
-
Good to know!
-
I have never tried to allocate such enormous amounts of memory using Delphi's heap manager (Fastmm4), I really don't know how it behaves if you try to allocate one huge chunk that is bigger than what the machine has physically. The documentation says "For win32 and Win64, the default FastMM Memory Manager is optimized for applications that allocate large numbers of small- to medium-sized blocks, as is typical for object-oriented applications and applications that process string data. " MapViewOfFile() bypasses the Delphi heap completely and leaves it up to Windows to map a contiguous block of virtual memory.
-
Isn't this what modern internet browser do, having separate child processes for tabs contained in a common host process ?
-
For size reasons. Memory mapped files let you - use contiguous arrays bigger than available RAM, mapping file-backed data into virtual 64-bit address space - use simple pointer arithmetics to access individual bytes, it is dead easy to implement SetBit() GetBit() etc - let the operating system's cache algorithm handle the intricacies of swapping pages in and out (LRU/MRU etc) - benefit from the speed and low latency of modern SSD's - have the data on disk, ready to be re-used Speed-wise this is only an option if the operating system can minimize swapping so accessing the elements shouldn't be totally random. If the probability of accessing an element is some kind of bell curve then it might just work. [edit] typo.
-
That's too bad - otherwise a memory mapped file might do the job.
-
Hello all, I have the impression that Sysutils.ReleaseExceptionObject is not working as advertized. I see that it's just a dummy procedure. Please find a testcase below. Calling TestCase(True) causes a memory leak whereas TestCase(false) works correctly. The memory leak is gone when I free the exception object manually. procedure AnalyzeException(ReRaise: Boolean); var e: Exception; begin e := Exception(AcquireExceptionObject); // ...Do something with the object ... if ReRaise then raise (e) at ExceptAddr else ReleaseExceptionObject ; //This should work but is a dummy procedure... //FreeAndNil(e); --> this works though end; Procedure TestCase (SwallowException:Boolean); var OneThousand, Zero: integer; d: double; begin Zero := 0; OneThousand := 1000; try d := OneThousand / Zero; except AnalyzeException(SwallowException); end; end;
-
ReleaseExceptionObject not working?
A.M. Hoornweg replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
Remy, this was just a tiny test case to reproduce the memory leak caused by the non-functionality of ReleaseExceptionObject. I was just trying to get a better understanding of the inner workings and lifetime management of exceptions. One such exercise was to detect if an exception was active (hence not passing it as a parameter), then to analyze it (and log the information somewhere) and to conditionally re-raise it based on the information gathered. Ideally I'd like to hook into the system before "except" even fires. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
Frankly, I have never used FixedInt/FixedUint and probably never will. The prefix "Fixed" does not convey any information, they might as well have called it TweakedInt. [edit] I see in unit system.pas that integer types Int8, Int16, Int32, int64, uint8, uint16, uint32, uint64 all exist. If we want a fixed 32 bit integer, we can specify that concisely. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
Do I have a surprise for you... Longint is platform dependent. Integer is now reliably 32-bit on all 32 and 64 bit platforms but not on ancient 16 bit platforms. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
Changing all incorrect pointer/integer casts is infinitely easier because the compiler tells us that the typecast is invalid at compile time. [edit] Having said that, I don't usually use the "tag" property of tcomponent etc anymore. It is much more convenient to use a tDictionary<tObject,tSomethingelse> to figure out if an object is associated with something else. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
Persisting data through records, files and streams etc would instantly become incompatible with existing software if the size of a common data type like "integer" changes. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
How do other IDE's handle design time support for third-party GUI elements? -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
One way to achieve isolation would be to load each package into a separate helper process. And yes, it would be a monumental breaking change. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
Of course. But I've seen many designtime packages of poor quality. And certain packages that I have installed inn Delphi 11.3 cause the IDE to throw an exception when I close it. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
What I would love to see is fully detachable tabs, like in modern browsers. -
Requested for IDE to support more RAM (vote/discuss if you care)
A.M. Hoornweg replied to Tommi Prami's topic in Delphi IDE and APIs
A 64-bit process can only load 64-bit designtime packages, so it would be a huge breaking change. Having said that, the very fact that designtime packages are loaded into the IDE process itself is also its Achilles heel. Errors in a package can bring down the IDE. It would be nice if that were no longer the case. -
New security requirements for code signing, disruptive ?
A.M. Hoornweg posted a topic in General Help
Hello all, On 23 june 2023, new security requirements for storing code signing certificates will come into force. I quote the most relevant change: "Effective 1 June 2023, the code signing certificate key pair must be generated and stored in a hardware crypto module that meets or exceeds the requirements of FIPS 140-2 level 2 or Common Criteria EAL 4+. This means the key pair will be generated in a device, where the private key cannot be exported. This will help to minimize the private key compromise." https://securityboulevard.com/2022/05/ca-browser-forum-updates-requirements-for-code-signing-certificate-private-keys/ As far as I can judge, this is highly disruptive. Our company has multiple developers that work remotely much of the time and we need to be able to rollout software updates in a timely fashion. It would very much interfere with our deployment processes if we are no longer allowed to store the keys on our development machines. Your opinions on this? -
11.3 mystery behavior - IDE lauches other app in project group after re-compile
A.M. Hoornweg replied to SwiftExpat's topic in Delphi IDE and APIs
Is there a "build event" set in any of these projects? That would execute a background program upon a full build.