Oops, I accidentally commented out the line allocating the memory in the example code... sorry.

// this statement causes core.exception.InvalidMemoryOperationError
        // auto t = new char[4096];

should read:

// this statement causes core.exception.InvalidMemoryOperationError
        auto t = new char[4096];

I can confirm that the daemon is not running with dmd 2.065:

$ ./testdaemon
Starting daemon mode, process id = 30147

$ ps -ef | grep testdaemon
  501 30149 35108   0  8:17pm ttys009    0:00.00 grep testdaemon

By removing the "close(STDOUT_FILENO);" from the daemon function, the InvalidMemoryOperationErrors appear on the screen.


On Saturday, 30 August 2014 at 18:05:01 UTC, Marc Schütz wrote:
On Saturday, 30 August 2014 at 17:36:41 UTC, safety0ff wrote:
On Saturday, 30 August 2014 at 17:09:41 UTC, JD wrote:
Hi all,

I tried to write a Linux daemon in D 2.065 (by translating one
in C we use at work). My basic skeleton works well. But as soon as I start allocating memory it crashed with several 'core.exception.InvalidMemoryOperationError's.

It works for me with 2.066, I do not have 2.065 installed at the moment to see if it fails on 2.065.

I tried to test it with Digger (in reverse mode), and it complained that the test succeeded with 2.065 (the supposedly bad version), so I guess I can't reproduce it with 2.065 here either.

Reply via email to