ets:to_dets/2 hanging

Vance Shipley vances@REDACTED
Wed Feb 5 22:24:48 CET 2003


In using ets:to_dets/2 to create persistent copies of some tables
I was using for tests I discovered a problem.  It seems that if I
create a table which is larger than 2MB the function ets:to_dets/2
will loop forever.

-module(t).
-export([new/1]).

new(Size) ->
        Tid = ets:new(foo, []),
        fill(Tid, Size).

fill(Tid, 0) -> Tid;
fill(Tid, Size) ->
        ets:insert(Tid, {Size, <<0:512>>}),
        fill(Tid, (Size - 1)). 


Erlang (BEAM) emulator version 5.2 [64-bit] [source] [threads:0]

Eshell V5.2  (abort with ^G)
1> T1 = t:new(60000).
11
2> ets:info(T1, memory).
1268976                            % file is 1.2MB
3> dets:open_file(t1, []).
{ok,t1}
4> ets:to_dets(T1, t1).    
t1                                 % no problem here
5>    
5> T2 = t:new(100000).
16
6> ets:info(T2, memory).
2114608                            % file is 2.1MB
7> dets:open_file(t2, []).
{ok,t2}
8> ets:to_dets(T2, t2).    
                                   % never returns (afters days at least :)


This would appear to be a bug.

	-Vance



More information about the erlang-questions mailing list