Skip to content

Request a v0.12.3 backport of the bulk_load Vec over-capacity fix #235

Description

@hxsf

This is an english version translated by chatGPT.

Summary

Would you consider releasing rstar v0.12.3 with a backport of the
RTree::bulk_load excessive memory retention fix from #220?

The fix is already included in v0.13.0, but upgrading to 0.13 also
requires adopting its breaking API changes. A 0.12.x patch release would
allow downstream users to receive this bug fix independently.

Relevant links:

Motivation

This is a substantial memory-retention bug rather than a new feature.

The bulk_load implementation in 0.12.2 uses Vec::split_off while
partitioning elements into slabs. The retained capacity can propagate into
leaf-node child vectors through Rust's in-place collect optimization.

In an OSM-based routing workload, we measured the following after bulk-loading
a regional spatial index:

  • Logical R-tree node storage: approximately 169 MB
  • Actual child-vector allocations: approximately 1.80 GB
  • Allocation overhead: approximately 1.63 GB, or about 90%
  • Rebuilding the same tree through a compact clone reduced it to approximately
    164 MB without changing query results

The effect becomes much larger for country-scale OSM datasets.

Downstream compatibility

Several downstream geospatial crates currently use rstar 0.12. For example,
the latest published geo 0.33.1 still depends on rstar ^0.12.0.

Support for rstar 0.13 has been merged into the geo repository, but it has
not yet been included in a crates.io release:

georust/geo#1536

This means downstream applications currently have to choose between:

  1. retaining the excessive memory usage;
  2. rebuilding or cloning the tree after bulk loading;
  3. patching/forking rstar 0.12; or
  4. adopting unreleased or breaking dependency upgrades.

Requested scope

If maintainers are open to a 0.12.3 release, the requested scope would be:

The fix appears isolated to the bulk-load implementation and should not require
public API changes.

I can help validate the backport against the OSM routing workload described
above if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions