Quantcast

enif_inspect_binary behaviour

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

enif_inspect_binary behaviour

Caragea Silviu
Hello,

I'm using enif_inspect_binary to get the content of a binary.

My question is if ErlNifBinary will be a copy of the erlang binary or the data member will point to the same memory location?

From my tests seems points to the same buffer as time If I change something when I return to erlang I can observe the change

Silviu

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: enif_inspect_binary behaviour

Ted Burghart
enid_inspect_binary populates the ErlNifBinary with read-only data that you should not modify.

See the section Functionality => Binaries at the top of the erl_nif manual page for how to make the data mutable.

– Ted

> On 6-Apr 2017, at 8:17 AM, Caragea Silviu <[hidden email]> wrote:
>
> Hello,
>
> I'm using enif_inspect_binary to get the content of a binary.
>
> My question is if ErlNifBinary will be a copy of the erlang binary or the data member will point to the same memory location?
>
> From my tests seems points to the same buffer as time If I change something when I return to erlang I can observe the change
>
> Silviu
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...