GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — insert_many holds the whole input in memory, so memory grows with the row count · Issue #294 · humemai/arcadedb-embedded-python

This repository was archived by the owner on Nov 21, 2026. It is now read-only.
This repository was archived by the owner on Nov 21, 2026. It is now read-only.

insert_many holds the whole input in memory, so memory grows with the row count #294

Copy link
Copy link
Closed
#295
Closed
insert_many holds the whole input in memory, so memory grows with the row count#294
#295
Copy link

Description

@tae898
tae898
opened on Oct 8, 2026
Issue body actions

Database.insert_many() holds the whole input in memory at once, so its memory grows linearly with the number of rows and a large load from a generator runs out of memory.

Cause

insert_many calls list(rows) on its iterable, serializes the entire list into one JSON text (json_bulk_dumps), and passes that text to DocumentBatcher.insertManyJson, which parses it into one JSONArray of every row before the first insert. commit_every only batches the commits; it does not bound what is held. Three copies of the input live at the same time:

  • the Python list of dicts and the JSON text: about 460 bytes per row for a five-property time-series point (measured without the JVM: 1.83 GB at 4M rows);
  • the parsed rows on the Java heap: a class histogram taken during a 500,000-row load shows 500,000 JsonObjects, 3,000,000 LinkedTreeMap$Nodes and 2,500,000 JsonPrimitives, about 1 KB per row, all live until the call returns.

At 25.9M rows (the TSBS ts1000 time-series lane) that is roughly 12 GB of Python objects plus about 26 GB of parsed rows on the heap, which is why the embedded document arm was OOM-killed at a 32 GB cap.

Reproduction

Five properties (host STRING, ts LONG, three DOUBLEs), UNIQUE index on (host, ts), rows from a generator, commit_every=10_000, -Xmx6g, 26.10.1 wheel, peak RssAnon:

rows peak RssAnon peak heap used
0.5M 1.9 GB 1.3 GB
1M 4.5 GB 3.5 GB
2M 5.5 GB 4.1 GB
4M 8.2 GB 5.8 GB

Calling insert_many once per 10,000-row slice of the same generator instead: 0.78, 0.99, 1.5 and 1.4 GB, and it was not slower.

Fix

Read the iterable one chunk (10,000 rows) at a time and send each chunk as its own JSON text inside the transaction insert_many manages, committing every commit_every rows counted across chunks. The per-row fallback and the parallel mode work per chunk too.

The graph paths (GraphBatch.create_vertices, new_edges) already send their JSON in 100,000-row chunks, and insert_columns takes columns the caller already holds, so neither has this growth.

Activity

  1. tae898
    closed this as completedin #295on Oct 8, 2026
  2. tae898
    added 2 commits that reference this issue on Oct 8, 2026

    bindings: insert_many reads its rows a chunk at a time, so memory no …

    e6e9f95

    /next: time-series document load OOM declared as the bindings' insert…

    a516e76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.