www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Allocation-free message passing?

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.)
May 02 2014