[erlang-questions] Determine if a binary is ref-counted in port driver code

Vance Shipley <>
Sat May 14 06:47:05 CEST 2011

On Thu, May 12, 2011 at 09:20:42PM +0100, Tim Watson wrote:
}  Currently I'm using a hack-around like so:
}      if (hsize->xsl_size < 64) {
}          data = &ev->iov[++bin_idx].iov_base[0];
}      } else {
}          data = ev->binv[++bin_idx]->orig_bytes;
}      }
}  seems to work, but I'm fairly sure it's not The Right Thing To Do (TM).

You are correct in that assumption.

}  Any pointers to better solutions would be much appreciated.

Just don't try and do what you are trying to do.  When you send
to the driver what comes out the other side is what the emulator
felt was the sensible thing to do.  You are meant to deal with it
as a binary.  The iolist and iovec optimizations are lost.


More information about the erlang-questions mailing list