Jump to solution
Verify

The Fix

pip install pydantic==1.10.18

Based on closed pydantic/pydantic issue #8652 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -89,6 +89,7 @@ class ConfigWrapper: use_attribute_docstrings: bool cache_strings: bool | Literal['all', 'keys', 'none'] + experimental_fast_build: bool def __init__(self, config: ConfigDict | dict[str, Any] | type[Any] | None, *, check: bool = True):
repro.py
from pydantic import BaseModel class Model(BaseModel): name: str surname: str age: int m = Model( name="Antonis", surname="Agapiou", age=27 )
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install pydantic==1.10.18\nWhen NOT to use: This fix may not be suitable for applications relying on specific memory behaviors.\n\n

Why This Fix Works in Production

  • Trigger: schema = cls.model_json_schema()["properties"]
  • Mechanism: Pydantic V2 has higher memory allocation due to changes in model building logic
  • Why the fix works: Introduced an experimental feature to opt-in for faster model builds, addressing memory allocation issues reported in Pydantic V2. (first fixed release: 1.10.18).

Why This Breaks in Prod

  • Shows up under Python 3.11 in real deployments (not just unit tests).
  • Pydantic V2 has higher memory allocation due to changes in model building logic
  • Production symptom (often without a traceback): schema = cls.model_json_schema()["properties"]

Proof / Evidence

Verified Execution

We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.

  • Status: PASS
  • Ran: 2026-02-11T16:52:29Z
  • Package: pydantic
  • Fixed: 1.10.18
  • Mode: fixed_only
  • Outcome: ok
Logs
affected (exit=None)
fixed (exit=0)

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“@matejkloska the problem is that we need a beta release of PyO3 to build from so that pydantic-core can be packaged by linux distros that…”
@samuelcolvin · 2024-01-29 · confirmation · source
“Memory usage will probably be significantly reduced by https://github.com/pydantic/pydantic-core/pull/1085. More detail to come.”
@samuelcolvin · 2024-01-29 · source
“@samuelcolvin thanks for the info! Please, is there any ETA for release? We notice the same issue while upgrading our codebase 🙏”
@matejkloska · 2024-01-29 · source
“This is amazing 🤩, I'm really looking forward to 2.7.”
@samuelcolvin · 2024-02-01 · source

Failure Signature (Search String)

  • schema = cls.model_json_schema()["properties"]
  • for field, attributes in schema.items():
Copy-friendly signature
signature.txt
Failure Signature ----------------- schema = cls.model_json_schema()["properties"] for field, attributes in schema.items():

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- schema = cls.model_json_schema()["properties"] for field, attributes in schema.items():

Minimal Reproduction

repro.py
from pydantic import BaseModel class Model(BaseModel): name: str surname: str age: int m = Model( name="Antonis", surname="Agapiou", age=27 )

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

Increased memory usage leading to potential application slowdowns or crashes.

Why It Broke

Pydantic V2 has higher memory allocation due to changes in model building logic

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==1.10.18

When NOT to use: This fix may not be suitable for applications relying on specific memory behaviors.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/pydantic/pydantic/pull/10064

First fixed release: 1.10.18

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix may not be suitable for applications relying on specific memory behaviors.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.
  • Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
  • Add a long-running test that repeats the failing call path and asserts stable memory.

Version Compatibility Table

VersionStatus
1.10.18 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.