Skip to content

remove 2048 byte clipboard limit for macOS - #2089

Merged
AucaCoyan merged 2 commits into
espanso:devfrom
woerndl:dev
Mar 6, 2025
Merged

AucaCoyan merged 2 commits into
espanso:devfrom
woerndl:dev

Conversation

@woerndl

@woerndl woerndl commented Oct 5, 2024

Copy link
Copy Markdown
Contributor

This resolves #1612 and #2051 on macOS, similar to the attempt #2085 on Windows.

The fix has been tested with multi-byte characters and large clipboard contents, even exceeding 10 MB. There is a caveat regarding memory management on macOS: Real and private memory are released as expected after copying large clipboard contents, but virtual memory still gradually increases over time. This PR doesn't resolve Espanso's general memory release issues on macOS, but it doesn't worsen them either. But it simplifies debugging by allowing tests with clipboard contents larger than 2 bytes.

Before this is released, it would be great if someone with more experience than I have to review not only this PR but also the overall memory management of Espanso (#1675). Especially since Espanso doesn't use ARC, I suspect there are parts of the code that could lead to leaks under certain circumstances. Probably in addition to the block Federico already identified in #1675.

The coding style in these files wasn't very consistent yet, so I maintained alignment on a per-file basis. Comments were added in a manner similar to those in the code for Windows.

@woerndl

woerndl commented Oct 5, 2024 •

Copy link
Copy Markdown
Contributor Author

I just noticed that I completely overlooked #2087 because it wasn't reflected in the issue the last time I checked. As I needed a fix, Espanso was bordering on being unusable for me due to this problem. Perhaps Kroum can use some of this. Otherwise, feel free to close. Thanks to everyone involved for trying to fix this.

@AucaCoyan

Copy link
Copy Markdown
Collaborator

Thank you! Don't worry, I still appreciate the effort you took in making this PR 😄 .
I'll keep this open until one of the prs is merged and verified 💯

@AucaCoyan

Copy link
Copy Markdown
Collaborator

Finally I could test this approach and it passed every test 🚀 .
Merging!

@AucaCoyan
AucaCoyan merged commit 9710499 into espanso:dev Mar 6, 2025
@PAPAMICA

PAPAMICA commented Mar 6, 2025

Copy link
Copy Markdown

Thank you very much for your work! ❤️

@marijuanatech

marijuanatech commented Mar 21, 2025 •

Copy link
Copy Markdown

Thank you for your efforts. Please excuse my ignorance here - do I have to wait for this to be packaged in a release or is there documentation somewhere for installing from the dev branch? I see the last release was in 2023 - do we anticipate this being included in a release anytime soon?

@smeech

smeech commented Mar 21, 2025

Copy link
Copy Markdown
Collaborator

We're working on a Release, but the certification for macOS is a hurdle. In the meantime, you'd have to compile from the repo, following the instructions in the documentation, in order to take advantage of the new feature (and others, awaiting documentation).

@n8henrie n8henrie mentioned this pull request May 1, 2025
sboldt1978 pushed a commit to sboldt1978/espanso that referenced this pull request Feb 11, 2026
* remove 2048 byte clipboard limit for macOS

* fix formatting issue

---------
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.

MacOS - Clipboard seem to be limited to 2048 characters

5 participants