jrr6 / caffeinator Goto Github PK
View Code? Open in Web Editor NEWA compact yet versatile menu-bar app for keeping your Mac awake.
Home Page: https://jrr6.github.io/Caffeinator
License: MIT License
A compact yet versatile menu-bar app for keeping your Mac awake.
Home Page: https://jrr6.github.io/Caffeinator
License: MIT License
If Caffeinator is terminated using killall
, Activity Monitor, or some other mechanism that is not the in-app menu item, the active caffeinate
sub-process (if it exists) is not properly terminated and continues to run, even after the Caffeinator instance is terminated.
killall Caffeinator
in the Terminalps aux | grep caffeinate
or Activity Monitor) that the caffeinate
process is still activeNo specific means of resolution has been decided upon at this time.
If "Prompt Before Executing" is enabled and the user open the process-based Caffeination dialog, enters a PID, but then cancels the Caffeination on the pre-execution prompt, the text of the "Caffeinate a Process…" label will still change to "Caffeinating [App Name/PID]" in the Caffeinator menu. This is because the change to the text is occurring in processClicked
, which is unaware of the possibility of cancelation in generateCaffeine
.
The process name lookup and label text changing should probably occur in generateCaffeine
, after ensuring that the Caffeination has not been canceled in the pre-execution prompt.
If the Caffeinator menu is opened after the pre-execution prompt or an input dialog is opened, the app crashes as soon as the dialog is closed (this does not affect error dialogs or the Check for Update dialog). It has been confirmed that runModalInFront
is always being called on the main thread.
Using the Caffeinator suite in JXA causes a memory leak when accessing properties on the caffeination
object (e.g., options
, active
).
The following script will cause about .3–.5 MB to be leaked (whereas the commented bottom-most line—using the Application suite—causes no leak):
for (i = 0; i < 2000; i++) {
if (Application("Caffeinator").caffeination.active() == true) { "active" } else { "stopped" }
// if (Application("Caffeinator").caffeination.options() == []) { "none" } else { "some" }
// console.log(Application('Caffeinator').version())
}
The leak has no correspondence to the size of the data returned by Caffeinator (e.g., causing options
to always return a 100-element array leaks no more memory than having options
always be empty). Even after replacing ScriptingCaffeination
with a dummy class that does no meaningful computation, the leak remains.
After 30 minutes of periodic AppleScript events (triggered by two-second polling by BetterTouchTool), leaked memory totaled approximately 2.4 MB. Over extended use, hundreds of megabytes have been observed to leak. Instruments does not seem to detect these cumulative leaks, but rather detects only a single, initial, 16-byte leak of category Security::CodeSigning::SecStaticCode::ValidationContext
. Allocations seem to stem from AEProcessAppleEvent
in the call tree.
Continue investigating behavior and source of memory leak. This may have to do with the design of OSA and how scripting is implemented.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.