|
|
翻erlang的代码发现erlang对memory的管理非常重视 内置了多种内存allocator:
- B: binary_alloc
- D: std_alloc
- E: ets_alloc
- F: fix_alloc
- H: eheap_alloc
- L: ll_alloc
- M: mseg_alloc
- S: sl_alloc
- T: temp_alloc
- Y: sys_alloc
多种分配策略:
1。 Best fit
2 。 Address order best fit
3. Good fit
4. A fit
还要一个erl_mtrace 模块专门收集erts允许期间的内存使用情况 然后通过tcp socket发送到 emem 这个程序中打印到 tty让人观察系统的情况。
emem在lib/tools/目录下 make install的时候默认没有安装。
启动 ./lib/tools/bin/i686-pc-linux-gnu/emem -p 1234
然后用erl -sname foo +Mit ip:1234就可以观察erlang的内存运作了.
注意erts的文档里面写:
+Mit X <!----> Reserved for future use. Do not use this flag.是属于未公开的 。 |
|