App hangs, GC.collect() fixet it. Why?

Steven Schveighoffer schveiguy at
Mon Sep 28 21:58:31 UTC 2020

On 9/28/20 3:28 PM, Bastiaan Veelo wrote:
> I’m leaning towards ditching the memory mapped I/O on the D end, and 
> replace it by regular serialisation/deserialisation. That will be a 
> manual rewrite though, which is a bit of bummer as memory mapped files 
> are widely used in our Pascal code. But this will probably give the best 
> end result.

2 things:

1. I agree this is the answer. If you ever ditch the old Pascal code, 
then you can reactivate the memory-mapped code.
2. You can possibly do the translation outside of your programs. That 
is, it wouldn't be entirely impossible to simply have a process running 
that ensures the "D view" and the "Pascal view" of the same file is kept 
in sync. Then you can keep the memory mapped code the same, and just 
define sane structures in your D code.

If you aren't required to have both Pascal and D programs reading and 
writing the file at the same time, this shouldn't be a problem.

BTW, one further thing I don't understand -- if this is memory mapped 
data, how come it has issues with the GC? And what do the "pointers" 
mean in the memory mapped data? I'm sure there's good answers, and your 
actual code is more complex than the simple example, but I'm just curious.


More information about the Digitalmars-d-learn mailing list