mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
bound size of hashtable with Sys.max_rray_length
This commit is contained in:
parent
484653fb08
commit
d101d913a2
1 changed files with 2 additions and 1 deletions
|
|
@ -96,7 +96,8 @@ let insert ~eq buckets h key value =
|
||||||
|
|
||||||
(** Resize the array, by inserting its content into twice as large an array *)
|
(** Resize the array, by inserting its content into twice as large an array *)
|
||||||
let resize ~eq ~hash buckets =
|
let resize ~eq ~hash buckets =
|
||||||
let buckets' = Array.make (Array.length buckets * 2) (my_null ()) in
|
let new_size = min (Array.length buckets * 2 + 1) Sys.max_array_length in
|
||||||
|
let buckets' = Array.make new_size (my_null ()) in
|
||||||
for i = 0 to Array.length buckets - 1 do
|
for i = 0 to Array.length buckets - 1 do
|
||||||
match buckets.(i) with
|
match buckets.(i) with
|
||||||
| (key, value, Used) ->
|
| (key, value, Used) ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue