Skip to content

Hashtbl.resize is not tail recursive #4747

@vicuna

Description

@vicuna

Original bug ID: 4747
Reporter: @mshinwell
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2017-09-24T15:32:01Z)
Resolution: fixed
Priority: high
Severity: minor
Version: 3.11.0
Target version: 4.03.1+dev
Fixed in version: 4.03.1+dev
Category: standard library
Tags: patch
Monitored by: lyongu @jmeber yminsky pzimmer @mmottl

Bug description

The function in Hashtbl.resize that copies the linked list attached to one bucket isn't tail recursive, which means that if you have the (admittedly undesirable) situation of a very long chain of buckets it can cause a stack overflow.

Degenerate example:

let ht = Hashtbl.create 100
let () = for x = 1 to 2500000 do Hashtbl.add ht 0 () done

File attachments

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions