Skip to content

Conversation

@Treadgold
Copy link

@Treadgold Treadgold commented Jan 31, 2026

Summary

Split large iterator chunks in IteratorByteStream into 64KB pieces to prevent memory spikes when sending large content streams.
This ensures that very large generator chunks are safely split into manageable sizes internally without changing the public API.
A test was added in tests/test_content.py to verify that large chunks are split correctly.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.(No Public docs changes were needed.)

Closes #3660

@Treadgold
Copy link
Author

Just realized there’s an existing PR (#3661) for this — completely happy for this one to be closed if maintainers prefer theirs, I should have checked before starting.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Very slow when sending large amounts of data using httpx.Client Post

1 participant