You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memory usage grows to approximately 1 GB and drops after relaunch (possible memory leak) #1504
Latest installed version according to the reporter as of 2026-11-11; exact version string to be confirmed.
Describe the bug
LinearMouse's memory usage grows during use and has reached approximately 1 GB. After quitting and reopening LinearMouse, memory usage becomes small again.
This may indicate a memory leak or another form of retained memory, but the cause has not been confirmed. I do not yet have a measured growth curve or know exactly how long it takes to reach this level.
To reproduce
A reliable minimal reproduction is not yet available. The observed sequence is:
Use LinearMouse normally.
Notice that memory usage has grown to approximately 1 GB.
Quit and relaunch LinearMouse.
Observe that memory usage has dropped to a small amount.
Expected behavior
Memory usage should remain bounded during normal long-running use.
Anything else?
I found the historical report #1185, which was reportedly fixed in v0.11.2. I am mentioning it for context, without assuming this has the same cause.
Please let me know which diagnostics would be most useful to investigate possible memory growth. Thank you!
Additional diagnostic information (privacy-filtered log):
I use both Bluetooth and USB receiver connections. The supplied log shows a Logitech USB receiver (VID=0x046D, PID=0xC52B), with paired device names including M585/M590 and K580.
Over approximately 4 minutes 45 seconds:
Receiver inventory is incomplete, retrying appears 16 times, along with 16 receiver slot-discovery starts.
Receiver snapshots repeatedly show four paired slots, with only slot 4 connected and slots 1–3 disconnected.
Metadata for disconnected slots is repeatedly queried.
There is also a Receiver logical discovery timed out; background retries will continue message.
Could this receiver discovery/retry path be relevant to the memory growth? This is only a lead: the log contains no memory measurements, its timing relative to the high-memory state is not established, and I have not confirmed any causal link. Bluetooth-only versus USB-receiver-only behavior has not yet been isolated.
The receiver diagnostic lines are included below. Application-switching records and application configuration have been omitted; calendar dates and the local receiver location ID have also been removed/redacted. Relative timing and diagnostic device details are retained. This is a filtered excerpt, not the complete original log.
Thanks for the log! I checked this on my own machine, which has the same receiver and the same retry loop as yours.
There is a leak, but it's not in the receiver code. LinearMouse creates a private CGEventSource each time the keyboard input source changes, and macOS leaves 16 KB of shared memory behind for every one. My instance had built up about 81 MB of these after 4.6 days. The receiver retries don't leak as far as I can tell, though they are pointless polling when a paired device is offline, so I'll look at that separately.
I'm not sure this explains the full 1 GB though, since that would take around 65,000 input source switches. Could you check a few things?
Next time memory is high, run this and paste the output:
I had already quit and relaunched LinearMouse, so I no longer have the high-memory instance available for the requested vmmap output. I'll capture it if memory becomes high again.
My macOS version is 27.0.1.
I'll follow up on the keyboard input-source switching frequency and whether any per-app switching tool is involved; I want to make sure I distinguish this from switching physical input devices/connections.
LinearMouse had been running for approximately one month when I noticed memory usage near 1 GB. This is an estimate, not a measured process uptime.
Thank you for clarifying that the receiver retry loop appears to be separate from the leak.
Following up on question 3: I switch between Chinese and English input very frequently. My input method automatically switches between Chinese and English depending on the application, and I also switch manually very often. I don't have an exact count of input-source change events, but the frequency is much higher than just a few times per day.
For additional context, I carry the laptop between my lab and dormitory every day and also switch pointing-device connections several times a day, using both Bluetooth and a USB receiver. I understand that these physical connection changes are separate from the keyboard input-source changes you identified.
Given the approximately one month of runtime, frequent manual and automatic input switching might be relevant, although I cannot confirm whether it accounts for the full ~1 GB without the requested memory breakdown.
Activity
toxdd commentedon Nov 11, 2026
Additional diagnostic information (privacy-filtered log):
I use both Bluetooth and USB receiver connections. The supplied log shows a Logitech USB receiver (
VID=0x046D, PID=0xC52B), with paired device names including M585/M590 and K580.Over approximately 4 minutes 45 seconds:
Receiver inventory is incomplete, retryingappears 16 times, along with 16 receiver slot-discovery starts.Receiver logical discovery timed out; background retries will continuemessage.Could this receiver discovery/retry path be relevant to the memory growth? This is only a lead: the log contains no memory measurements, its timing relative to the high-memory state is not established, and I have not confirmed any causal link. Bluetooth-only versus USB-receiver-only behavior has not yet been isolated.
The receiver diagnostic lines are included below. Application-switching records and application configuration have been omitted; calendar dates and the local receiver location ID have also been removed/redacted. Relative timing and diagnostic device details are retained. This is a filtered excerpt, not the complete original log.
Filtered receiver diagnostic log (114 lines)
lujjjh commentedon Nov 11, 2026
Thanks for the log! I checked this on my own machine, which has the same receiver and the same retry loop as yours.
There is a leak, but it's not in the receiver code. LinearMouse creates a private
CGEventSourceeach time the keyboard input source changes, and macOS leaves 16 KB of shared memory behind for every one. My instance had built up about 81 MB of these after 4.6 days. The receiver retries don't leak as far as I can tell, though they are pointless polling when a paired device is offline, so I'll look at that separately.I'm not sure this explains the full 1 GB though, since that would take around 65,000 input source switches. Could you check a few things?
toxdd commentedon Nov 11, 2026
Thanks for investigating and finding the leak!
Here are the details I can provide now:
vmmapoutput. I'll capture it if memory becomes high again.Thank you for clarifying that the receiver retry loop appears to be separate from the leak.
toxdd commentedon Nov 11, 2026
Following up on question 3: I switch between Chinese and English input very frequently. My input method automatically switches between Chinese and English depending on the application, and I also switch manually very often. I don't have an exact count of input-source change events, but the frequency is much higher than just a few times per day.
For additional context, I carry the laptop between my lab and dormitory every day and also switch pointing-device connections several times a day, using both Bluetooth and a USB receiver. I understand that these physical connection changes are separate from the keyboard input-source changes you identified.
Given the approximately one month of runtime, frequent manual and automatic input switching might be relevant, although I cannot confirm whether it accounts for the full ~1 GB without the requested memory breakdown.
Unifying receivers no longer retry discovery forever while a paired d…
Memory no longer grows each time the keyboard input source changes (l…