Read-only binary: does it stay in the same memory location?

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

Read-only binary: does it stay in the same memory location?

Frank Muller
Hi guys

Suppose I’ve a big binary (35MB) in the state of my gen_server process X.

This binary is never shared with any other process, it’s never updated, and stays there for lifetime of process X.

Question: internally, may the VM moves this binary around to different memory locations if needed? Or not because this binary is never shared/updated ?

/Frank

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

Re: Read-only binary: does it stay in the same memory location?

Dmytro Lytovchenko
No, the binary will not be moved unless there is some scan algorithm implemented in GC to visit all process heaps, all registers and all stacks and possibly all ETS tables and update all pointers to a moved binary. Which i really doubt it is happening. So no, it will never be moved until garbage collected.

2017-12-22 0:10 GMT+01:00 Frank Muller <[hidden email]>:
Hi guys

Suppose I’ve a big binary (35MB) in the state of my gen_server process X.

This binary is never shared with any other process, it’s never updated, and stays there for lifetime of process X.

Question: internally, may the VM moves this binary around to different memory locations if needed? Or not because this binary is never shared/updated ?

/Frank

_______________________________________________
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