[erlang-questions] mmap file to binary

Max Lapshin max.lapshin@REDACTED
Fri Apr 9 13:46:27 CEST 2010


On Fri, Apr 9, 2010 at 3:37 PM, Tony Rogvall <tony@REDACTED> wrote:
> Check out the ErlNifResource stuff, this will handle the garage collection for data like this.
> (yes, it is aso using the magic stuff)

No, it is not enough, because ErlNifResourceDtor receives only pointer
to data, but mmap also requires size in bytes.
So to implement mmap we need to use other function, not nif_resource_dtor

> My suggestions for drivers is one ErlDrvObject where you can store the actual object data
> inline and pass it back and forth from driver to runtime. It will appear as a binary.

you think, that it may be easier to implement it as a driver?

>
> Still the orig_bytes must be change. There are not to many places in the VM that uses the fact
> that orig_bytes is not a pointer, so the change should not be hard (if it's not done already ;-)
>

I haven't understood: is the problem with orig_bytes now?


More information about the erlang-questions mailing list