Skip to content

fix: move http upload state to heap#657

Merged
daveallie merged 2 commits intocrosspoint-reader:masterfrom
ngxson:xsn/upload_state
Feb 5, 2026
Merged

fix: move http upload state to heap#657
daveallie merged 2 commits intocrosspoint-reader:masterfrom
ngxson:xsn/upload_state

Conversation

@ngxson
Copy link
Contributor

@ngxson ngxson commented Feb 1, 2026

Summary

The main motivation behind this PR was because uploadBuffer is statically allocated, but only used when web server is enabled. This results in 4KB of memory sitting idle most of the time.

As expected, 4KB of initial RAM is freed with this PR:

master:
RAM:   [===       ]  32.5% (used 106508 bytes from 327680 bytes)

PR:
RAM:   [===       ]  31.2% (used 102276 bytes from 327680 bytes)

Additional Context

This also highlights the importance of only using statically-allocated buffer when absolutely needed (for example, if the component is active most of the time). Otherwise, it makes more sense to tie the buffer's life cycle to its activity.


AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO

daveallie
daveallie previously approved these changes Feb 2, 2026
@daveallie daveallie merged commit db659f3 into crosspoint-reader:master Feb 5, 2026
2 checks passed
jdk2pq added a commit to jdk2pq/crosspoint-reader that referenced this pull request Feb 5, 2026
* master:
  feat: add shift lock to KeyboardEntryActivity (crosspoint-reader#513)
  feat: rename and move in file manager (crosspoint-reader#630)
  feat: Implement fix for sunlight fading issue (crosspoint-reader#603)
  chore: Add PR title check on sync (crosspoint-reader#698)
  feat: Go To Position for epubs (crosspoint-reader#666)
  feat: Calibre Web Automated (CWA) koreader sync server support (crosspoint-reader#594)
  chore: Add CI check job to consolidate status (crosspoint-reader#696)
  chore: CI Build Summary - firmware stats, firmware artifact (crosspoint-reader#601)
  feat: quick rotate option in epub reader menu (crosspoint-reader#685)
  feat(settings): add "Cover + Custom" sleep screen mode (crosspoint-reader#582)
  fix: Artifacts on Thumb on Home Screen (crosspoint-reader#662)
  feat: holding back button while booting, boots to home screen as a mean of escaping boot loop (crosspoint-reader#587)
  docs: Add small SCOPE.md and GOVERNANCE.md documents (crosspoint-reader#640)
  feat: front button remapper (crosspoint-reader#664)
  feat: UI themes, Lyra (crosspoint-reader#528)
  feat: Add CSS parsing and CSS support in EPUBs (crosspoint-reader#411)
  fix: move http upload state to heap (crosspoint-reader#657)
Unintendedsideeffects pushed a commit to Unintendedsideeffects/crosspoint-reader that referenced this pull request Feb 17, 2026
## Summary

The main motivation behind this PR was because `uploadBuffer` is
statically allocated, but only used when web server is enabled. This
results in 4KB of memory sitting idle most of the time.

As expected, 4KB of initial RAM is freed with this PR:

```
master:
RAM:   [===       ]  32.5% (used 106508 bytes from 327680 bytes)

PR:
RAM:   [===       ]  31.2% (used 102276 bytes from 327680 bytes)
```

## Additional Context

This also highlights the importance of only using statically-allocated
buffer when absolutely needed (for example, if the component is active
most of the time). Otherwise, it makes more sense to tie the buffer's
life cycle to its activity.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
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.

2 participants