Allocation-free message passing?

JR via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 2 03:49:49 PDT 2014


I'm trying to impose limits upon myself to, well, learn. 
Currently I'm exploring ways to avoid allocations -- but my 
program is running in three threads with considerable amounts of 
message passing between them.

Unless I'm misinterpreting my callgraph, 
std.concurrency.MessageBox contains a struct Node, which 
MessageBox.put does a new on. That's the only explicit allocation 
I can find in there.


     void put( T val )
     {
         put( new Node( val ) );
     }


It makes sense to store messages on the heap. Even so, is there a 
different way of doing it?

(Again, it's more of a challenge than it is micro-optimizing.)


More information about the Digitalmars-d-learn mailing list