On Thursday, 1 April 2021 at 09:30:28 UTC, DLearner wrote:
On Wednesday, 31 March 2021 at 23:21:59 UTC, russhy wrote:
On Wednesday, 31 March 2021 at 17:54:38 UTC, DLearner wrote:
[...]

Can you show the print function?

Maybe the problem lies there?

Using rdmd, I believe the code below demonstrates the situation.

import std.stdio;
void main() {
   immutable uint  MemSize=100;  // Memory size in bytes.
   uint counter;
   uint idx;
   ubyte* WkPtr;
   ubyte WkUbyte;

// Memory Pool
ubyte[MemSize] MemPool = 8; // Initialised to 8 for debugging.

   WkPtr = &MemPool[0];

   counter = 1;
   while (counter <= 102) {

      idx = counter - 1;
        
          WkUbyte = *(WkPtr + idx);

      writeln("idx = ", idx, "WkUbyte = ", WkUbyte);

      counter = counter + 1;
   }
}

memset would fill a whole page even if the specified size is in the middle of a page. Try with 64, 4096 for example, instead of 100.

Reply via email to