When are binaries copied as opposed to referenced?

Joel Reymont <>
Sat Jul 9 21:36:53 CEST 2005


Folks,

Would you comment on my assumptions regarding Erlang in this post:

http://wagerlabs.com/uptick/2005/07/efficient-backtesting-and-data- 
storage.html

Suppose I have a few million ticks to test on. I would need a  
"sliding window" onto this data where I always add to the front of  
the window and drop the last tick as I move forward in time. Lets say  
I need to keep at least 500 ticks around for my strategy to work.

If I keep the orinal few million ticks in memory as a large binary or  
a list of binaries then the sliding window would most likely be  
created as a reference into the large binary as opposed to a copy. If  
that is the case then there should be no garbage collection. Multiple  
processes (strategies) running in the same VM would obtain as many  
references to the large binary as they need.

Is this correct?

     Thanks, Joel

--
http://wagerlabs.com/uptick






More information about the erlang-questions mailing list