:: On Sun, 8 May 2022 14:57:19 +0200
:: (microsoft.public.vb.general.discussion)
:: <t58fpq$v37$
2...@dont-email.me>
:: "Wendelin Uez" <
wu...@online.de> wrote:
> In case of speed problems when this overhead becomes important you
> might better use Windows' own mechanism of swapping data from RAM to
> file employing memory mapped files (MMF) where you can setup a huge
> disk file and let Windows transfer data chunks from memory to file in
> background with high efficiency, your app only has to fill memory
> buffer and to tell Windows to save it.
>
> The only bad thing is that MMFs are of static size, they cannot gow
> dynamically, but you can create as many MMFs as your disk can store
> and address them as needed.
Yes, MMF is a way to deal with quickly storing large amounts of data,
in such a case the APIs will deal with memory but the underlying system
mechanism will then take care of asynchronously store the data to the
swapfile (if the MMF is an unnamed one)
Another approach would be using a named pipe; in such a case the
process may create a named pipe and write the received data to it, then
another process or at a later moment, the pipe could be re-read and the
data processed
Just to be clear, here's a possible approach; let's assume the data
comes, over the network, from a listening socket
The main program starts creates a named pipe and opens it in write mode,
next it instances an ActiveX exe which will run as a separate process
passing to it the pipe name, then the main program starts listening on
the socket
The AX exe once started opens the named pipe in read mode and keeps
polling it and waiting for incoming data
The main program receives data on the socket and immediately writes
them to the named pipe
The AX exe sees that there are data in the named pipe, reads them and
processes them; being a separate process and having the named pipe as a
FIFO buffer the AX exe can "spend" the needed time in processing the
data
Notice that the above assumes that the whole thing runs on some
"modern" version of windows (say Windows 7) since in such a case named
pipes can hold up to about 1.5GB of data, that gives plenty of room for
data waiting to be processed, by the way since the AX exe will read
(and remove) data from the pipe, the 1.5GB limit will probably never be
reached