[erlang-questions] Unstable erlang compared to java or perl
Ryan Zezeski
rzezeski@REDACTED
Sun Nov 7 22:28:01 CET 2010
On Sun, Nov 7, 2010 at 4:21 PM, Jesper Louis Andersen <
jesper.louis.andersen@REDACTED> wrote:
> On Sun, Nov 7, 2010 at 10:15 PM, Petter Egesund
> <petter.egesund@REDACTED> wrote:
>
> > Full source code? It is unfortunately to long and to data-bound to
> > make sense. Still hoping for a clue - ets:i() tells me that total ets
> > should be less than to 1 gb total, but memory() says it is using more
> > than 5 gb for ets.
>
> ets:i/0 reports words.
> erlang:memory/0 reports bytes.
>
> So that should not be surprising that they differ by a factor of 4.
>
> --
> J.
>
Jesper beat me to it...the memory reported by ets:info and ets:i is in
words...not bytes.
Petter, I don't think you're actually deleting these tables, which is proven
by the fact that they show up in ets:i/0. I'll say it again, they are not
garbage collected...they don't live on the process heap. THere are two ways
to delete an ETS table: 1) call ets:delete or 2) the owner dies and there is
no heir. When they are deleted the memory is reclaimed.
Here is a erl session showing what I mean...
1> ets:i().
id name type size mem owner
----------------------------------------------------------------------------
13 code set 257 10711 code_server
4110 code_names set 57 7754 code_server
8207 shell_records ordered_set 0 112 <0.25.0>
ac_tab ac_tab set 6 878
application_controller
file_io_servers file_io_servers set 0 322 file_server_2
global_locks global_locks set 0 322 global_name_server
global_names global_names set 0 322 global_name_server
global_names_ext global_names_ext set 0 322 global_name_server
global_pid_ids global_pid_ids bag 0 322 global_name_server
global_pid_names global_pid_names bag 0 322 global_name_server
inet_cache inet_cache bag 0 322 inet_db
inet_db inet_db set 29 706 inet_db
inet_hosts_byaddr inet_hosts_byaddr bag 0 322 inet_db
inet_hosts_byname inet_hosts_byname bag 0 322 inet_db
inet_hosts_file_byaddr inet_hosts_file_byaddr bag 0 322 inet_db
inet_hosts_file_byname inet_hosts_file_byname bag 0 322 inet_db
ok
2> ets:new(test, [public, named_table]).
test
3> ets:i().
id name type size mem owner
----------------------------------------------------------------------------
13 code set 257 10711 code_server
4110 code_names set 57 7754 code_server
8207 shell_records ordered_set 0 112 <0.25.0>
ac_tab ac_tab set 6 878
application_controller
file_io_servers file_io_servers set 0 322 file_server_2
global_locks global_locks set 0 322 global_name_server
global_names global_names set 0 322 global_name_server
global_names_ext global_names_ext set 0 322 global_name_server
global_pid_ids global_pid_ids bag 0 322 global_name_server
global_pid_names global_pid_names bag 0 322 global_name_server
inet_cache inet_cache bag 0 322 inet_db
inet_db inet_db set 29 706 inet_db
inet_hosts_byaddr inet_hosts_byaddr bag 0 322 inet_db
inet_hosts_byname inet_hosts_byname bag 0 322 inet_db
inet_hosts_file_byaddr inet_hosts_file_byaddr bag 0 322 inet_db
inet_hosts_file_byname inet_hosts_file_byname bag 0 322 inet_db
test test set 0 322 <0.31.0>
ok
4> ets:delete(test).
true
5> ets:i().
id name type size mem owner
----------------------------------------------------------------------------
13 code set 257 10711 code_server
4110 code_names set 57 7754 code_server
8207 shell_records ordered_set 0 112 <0.25.0>
ac_tab ac_tab set 6 878
application_controller
file_io_servers file_io_servers set 0 322 file_server_2
global_locks global_locks set 0 322 global_name_server
global_names global_names set 0 322 global_name_server
global_names_ext global_names_ext set 0 322 global_name_server
global_pid_ids global_pid_ids bag 0 322 global_name_server
global_pid_names global_pid_names bag 0 322 global_name_server
inet_cache inet_cache bag 0 322 inet_db
inet_db inet_db set 29 706 inet_db
inet_hosts_byaddr inet_hosts_byaddr bag 0 322 inet_db
inet_hosts_byname inet_hosts_byname bag 0 322 inet_db
inet_hosts_file_byaddr inet_hosts_file_byaddr bag 0 322 inet_db
inet_hosts_file_byname inet_hosts_file_byname bag 0 322 inet_db
ok
More information about the erlang-questions
mailing list