[erlang-questions] limit on ets:select/3

Ulf Wiger ulf.wiger@REDACTED
Wed Apr 7 11:35:23 CEST 2010


Sverker Eriksson wrote:
> Yes, the BIF (ets_select_3) throws badarg if Limit is a bignum. The 
> reference documentation does not mention any bounds on Limit.
> 
> Not sure what the best solution is:
> 1. Document the current behavior, an upper bound that depends on 
> architecture (32 or 64 bit).
> 2. Enforce the same upper bound on 64-bit as the current on 32-bit and 
> document that.
> 3. Remove the badarg and instead continue with the upper bound as Limit 
> and document that.
> 4. Combine 2&3.
> 5. Any other ideas...

I vote for (1). I doubt that people need to use limits in the
bignum range, and if they do, it had better be on a 64-bit machine
anyway - as trying to create a list of hundreds of million objects
on the process heap in a single operation is likely to be fatal.

The trivial workaround is to make multiple calls to select/3,
and the overhead of doing so will be entirely insignificant
compared to the cost of copying millions of objects onto the
heap anyway.

A similar limit exists on receive timeouts, and there it is much
more likely that one would like to exceed the limit. However, most
people seem to accept the current situation as adding more checks
will introduce overhead in the vast number of cases where the
limit is not a problem.

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
http://www.erlang-solutions.com
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list