{"id":20806303,"url":"https://github.com/nodesource/nsolid-command-gc","last_synced_at":"2025-09-28T11:30:44.606Z","repository":{"id":57312316,"uuid":"80054700","full_name":"nodesource/nsolid-command-gc","owner":"nodesource","description":"an N|Solid custom command to request garbage collection","archived":true,"fork":false,"pushed_at":"2017-01-25T20:29:51.000Z","size":1746,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-15T15:32:58.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodesource.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-25T20:27:37.000Z","updated_at":"2025-02-01T13:59:45.000Z","dependencies_parsed_at":"2022-08-27T16:50:51.655Z","dependency_job_id":null,"html_url":"https://github.com/nodesource/nsolid-command-gc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nodesource/nsolid-command-gc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fnsolid-command-gc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fnsolid-command-gc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fnsolid-command-gc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fnsolid-command-gc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodesource","download_url":"https://codeload.github.com/nodesource/nsolid-command-gc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fnsolid-command-gc/sbom","scorecard":{"id":692771,"data":{"date":"2025-08-11","repo":{"name":"github.com/nodesource/nsolid-command-gc","commit":"c7fb0f71fbb3cb39080f2f24dcd75b17020fc46f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/1 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: npmCommand not pinned by hash: test/test.sh:33","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T02:42:49.693Z","repository_id":57312316,"created_at":"2025-08-22T02:42:49.693Z","updated_at":"2025-08-22T02:42:49.693Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276081678,"owners_count":25581948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T19:19:12.638Z","updated_at":"2025-09-28T11:30:44.253Z","avatar_url":"https://github.com/nodesource.png","language":"Shell","readme":"nsolid-command-gc - an N|Solid custom command to request garbage collection\n================================================================================\n\nThis package provides an [N|Solid custom command][] to request garbage\ncollection for an N|Solid process.  After installing the custom command as an\nnpm package, you can then register the command in your app - when running\nyour app with the N|Solid Runtime, you'll be able to request garbage collection \nwith the `nsolid-cli` tool.\n\nFor more information on N|Solid, visit the [N|Solid product page][].\n\n![demo](images/demo.gif)\n\nInstallation\n================================================================================\n\n    npm install nsolid-command-gc\n\n\nUsage\n================================================================================\n\nOnce you have installed the package, you can register the `gc` custom command within\nyour apps in one of two ways:\n\n* Add `require('nsolid-command-gc')` somewhere in your application code\n\n* Add the arguments `--require nsolid-command-gc` to your `nsolid` command\n  invocation; the `--require` option is standard in modern versions of\n  Node.js, including the N|Solid Runtime\n\nThe second option requires no changes to your code, so it obviously wins!\n\nYou will also need to use the Node.js `--expose-gc` option, which will add\na `gc()` function to the `global` object. This package uses this function to\nrequest the garbage collection.\n\nOnce the `gc` custom command has been registered, garbage collection can be\nrequested for these apps with the `nsolid-cli` command, using the `custom`\nsubcommand with the `--name gc` option.\n\n## Putting this all together:\n\nRun your app with the `gc` custom command registered:\n\n    nsolid --require nsolid-command-gc --expose-gc [other Node.js parameters]\n\nRequest garbage collection for that process, where `$AGENT_ID` is the agent id\nfor that process:\n\n    nsolid-cli custom --id $AGENT_ID --name gc\n\nBy default, a 'full' garbage collection is requested. For a 'minor' garbage\ncollection, use the arguments `--data minor`, as in:\n\n    nsolid-cli custom --id $AGENT_ID --name gc --data minor\n\nThe result of the `nsolid-cli custom` command is a line of JSON, that has a\n`result` property as a top-level property.  The value of that property contains\ntwo properties: `status` and `type`.  The `status` property indicates whether\nthe garbage collection was able to be requested.  The `type` property returns\n`full` or `minor` depending on which type of garbage collection was requested.\nFor example:\n\n    {\n      \"result\": {\n        \"status\": \"OK\",\n        \"type\": \"full\"\n        },\n        \"id\": \"\u003cagent id\u003e\",\n        \"app\": \"\u003cyour app name\u003e\",\n        \"hostname\": \"\u003chostname\u003e\",\n        \"tags\": ['\u003cprocess tag', ...],\n        \"time\": \u003ctime command was run\u003e\n      }\n\nWhen the `gc` command is registered, and when it is invoked, the process it is\nregistered with will output messages to `stderr` via\n[`process.emitWarning()`][process.emitWarning]†.  You can use Node.js\ncommand-line options and event emitters on `process` to customize the behavior\nof this method call.\n\n† `process.emitWarning` is only available in N|Solid based on Node.js LTS 6.x Boron\nand newer. Argon-based N|Solid releases will simply use `process.stderr`.\n\n\nExample Usage\n================================================================================\n\nA sample is shipped with this package, in the `test` directory, named\n`generate-garbage.js`.  This application generates and then orphans a lot of\nreferences that need to be garbage collected. After letting it run for a few\nseconds, and then using the `gc` custom command, you should see a drop in the\nprocess's [`rss`][rss] memory value.  Hint: use the N|Solid Console to watch the\n`rss` value drop in the process graphs.\n\nNote that for this example, you will need to have the N|Solid Storage server\nalready running, and will probably want the N|Solid Console running as well.\nFor more information on installing and using the N|Solid Storage and Console\nservers, see the [N|Solid documentation site][].\n\nWe'll assume you've already run `npm install nsolid-command-gc` for your\napplication, and that the package is available in\n`node_modules/nsolid-command-gc`.\n\nFirst, let's set some environment variables for N|Solid:\n\n    export NSOLID_APPNAME=generate-garbage # the name of the N|Solid application\n    export NSOLID_COMMAND=9001             # the command port of N|Solid Storage\n\nNow run the test app with the `gc` custom command enabled:\n\n    nsolid --require nsolid-command-gc --expose-gc node_modules/nsolid-command-gc/test/generate-garbage.js\n\nYou should see the following message in the output of the process, indicating\nthe custom command has been installed:\n\n    (nsolid:$PID) nsolid-command-gc: installing nsolid custom command \"gc\"\n\nBy monitoring this process in the N|Solid Console, you can see memory usage\nincreasing.\n\nTo request a garbage collection, we first need to know the agent id of the\nprocess.  You can see it in the URL from the N|Solid Console when viewing the\nprocess details - it's a 40 character hex string that is a path element of the\npage's URL.  Alternatively, you can get it from with the `nsolid-cli ls` command.  \nSince the `nsolid-cli ls` command outputs a line of JSON for every N|Solid process, \nyou probably want to have a nice JSON swiss army knife utility like [jq][] handy to\nproduce more readable output. Using `jq` and `grep` as filters, the following\ncommand will print out the agent id of the `generate-garbage` application:\n\n    nsolid-cli ls | grep generate-garbage | jq .id\n\nNow, given the agent id, you can request garbage collection with the\ncommand, where you would replace `$AGENT_ID` below with the actual agent id:\n\n    nsolid-cli custom --id $AGENT_ID --name gc | jq\n\nThe nice looking output formated from `jq` will look like this:\n\n```json\n{\n  \"result\": {\n    \"status\": \"OK\",\n    \"type\": \"full\"\n  },\n  \"id\": \"a2827de4011e0b683c101aae7db5c37e9c62c5c7\",\n  \"app\": \"generate-garbage\",\n  \"hostname\": \"your-hostname-here\",\n  \"tags\": [],\n  \"time\": 1484957897813\n}\n```\n\nThe process the command is sent to should also print the following message:\n\n    (nsolid:$PID) nsolid-command-gc: requesting full garbage collection\n\nYou should notice the garbage collection visually in N|Solid Console, by a drop\nin memory measurements in the graphs.\n\n\nContributing\n================================================================================\n\nTo submit a bug report, please create an [issue at GitHub][].\n\nIf you'd like to contribute code to this project, please read the\n[CONTRIBUTING.md][] document.\n\n\nAuthors and Contributors\n================================================================================\n\n\u003ctable\u003e\u003ctbody\u003e\n  \u003ctr\u003e\n    \u003cth align=\"left\"\u003ePatrick Mueller\u003c/th\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/pmuellr\"\u003eGitHub/pmuellr\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://twitter.com/pmuellr\"\u003eTwitter/@pmuellr\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\n\nLicense \u0026 Copyright\n================================================================================\n\n**nsolid-command-gc** is Copyright (c) 2017 NodeSource and licensed under the\nMIT license. All rights not explicitly granted in the MIT license are reserved.\nSee the included [LICENSE.md][] file for more details.\n\n[N|Solid product page]: https://nodesource.com/products/nsolid\n[N|Solid documentation site]: https://docs.nodesource.com\n[N|Solid custom command]: https://docs.nodesource.com/docs/custom-commands\n[rss]: https://en.wikipedia.org/wiki/Resident_set_size\n[jq]: https://stedolan.github.io/jq/\n[issue at GitHub]: https://github.com/nodesource/nsolid-command-gc/issues\n[CONTRIBUTING.md]: CONTRIBUTING.md\n[LICENSE.md]: LICENSE.md\n[process.emitWarning]: https://nodejs.org/dist/latest-v6.x/docs/api/process.html#process_event_warning\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fnsolid-command-gc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesource%2Fnsolid-command-gc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fnsolid-command-gc/lists"}