Hello , I have a question to system administrators (who deal with servers) about The Bat! filling free memory with zero bytes.
What do you think if we change The Bat! to intermittently fill with zero bytes the memory, with which The Bat! is working on, but frees in the meanwhile (not actually uses)? So The Bat! will clean memory pages with zero bytes? This may improve performance under Windows, and also under VMWare and other virtual machine environments? For example, VMWare and HyperV calculate hash of memory pages, and, if the contents is the same, mark this page as "shared" inside a virtual machine and between virtual machines on the same host, until the page is modified. It effectively decreases memory consumption. Windows does the same - it handles zero pages differently, treating them as free. We could have the heap manager that would automatically fill memory with zeros when we call FreeMem/ReallocMem. As an alternative option, we could have a function that zeroizes empty memory by demand, i.e. only when this function is explicitly called. Of course, this function has to be thread-safe. The drawback of filling memory with zeros is touching the memory, which might have already been turned into virtual, thus issuing page faults. Besides that, any memory store operations are slow, so our program will be slower, albeit to an unknown extent (maybe negligible). If we manage to fill 4-K pages completely with zeros, the hypervisor or Windows will explicitly mark it as a zero page. But even partial zeroizing may be beneficial, since the hypervisor may compress pages using LZ or similar algorithms to save physical memory. Does anybody have experience on that issue? I have made a question on https://stackoverflow.com/questions/44665446/a-heap-manager-for-c-pascal-that-automatically-fills-freed-memory-with-zero-byte on that matter, but it didn't gain enough attention. -- Maxim Masiutin Director Ritlabs, SRL ________________________________________________________ Current beta is 7.4.16.21 | 'Using TBBETA' information: http://www.silverstones.com/thebat/TBUDLInfo.html