{"id":17659735,"url":"https://github.com/raphamorim/memory-inspector","last_synced_at":"2025-05-07T15:03:25.366Z","repository":{"id":57294533,"uuid":"118521767","full_name":"raphamorim/memory-inspector","owner":"raphamorim","description":"Memory Inspector watches memory usage/behaviour of an Web Application","archived":false,"fork":false,"pushed_at":"2018-03-09T17:08:45.000Z","size":18,"stargazers_count":22,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T02:17:52.150Z","etag":null,"topics":["jest","memory","nodejs","perfomance","puppeteer","react-tv","reporting","web-app"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/memory-inspector","language":"JavaScript","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/raphamorim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-22T22:06:45.000Z","updated_at":"2023-03-09T14:35:32.000Z","dependencies_parsed_at":"2022-09-02T07:40:12.463Z","dependency_job_id":null,"html_url":"https://github.com/raphamorim/memory-inspector","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fmemory-inspector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fmemory-inspector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fmemory-inspector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fmemory-inspector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphamorim","download_url":"https://codeload.github.com/raphamorim/memory-inspector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242980783,"owners_count":20216283,"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","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":["jest","memory","nodejs","perfomance","puppeteer","react-tv","reporting","web-app"],"created_at":"2024-10-23T16:08:07.720Z","updated_at":"2025-03-11T05:33:14.839Z","avatar_url":"https://github.com/raphamorim.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# memory-inspector\n\n\u003c!-- [START badges] --\u003e\n[![CircleCI](https://circleci.com/gh/raphamorim/memory-inspector/tree/master.svg?style=svg)](https://circleci.com/gh/raphamorim/memory-inspector/tree/master)\n\u003c!-- [END badges] --\u003e\n\n\u003cimg src=\"images/logo.png\" height=\"200\" align=\"right\"\u003e\n\n\u003e Memory Inspector watches memory usage/behavior of an Web Application.\nCurrently it runs over Puppeteer, which is an API to control headless Chrome or Chromium over the DevTools Protocol.\n\n#### Installing\n\n```bash\nyarn add --dev memory-inspector\n```\n\n## Usage\n\n#### Example 1\n\n```js\nconst memoryInspector = require('memory-inspector')\n\nconst config = {\n  url: 'http://localhost:3000',\n  maxMemoryLimit: 20 * 1048576, // should not pass of 20MB\n  maxMemoryPercentThreshold: 90, // should not pass 90% of total memory\n}\n\nmemoryInspector(config).then((info) =\u003e console.log(info))\n\n/*\n{ \"exceededMemoryMaximum\": 1528951424,\n  \"exceededMemoryUsagePercent\": true,\n  \"jsHeapSizeLimit\": \"2.19 GB\",\n  \"memoryUsagePercent\": 21900000,\n  \"totalJSHeapSize\": \"1.53 GB\",\n  \"usedJSHeapSize\": \"1.53 GB\" }\n*/\n\n```\n\n#### Example 2\n\n```js\nconst memoryInspector = require('memory-inspector')\n\nconst config = {\n  url: 'http://127.0.0.1:8080',\n  delay: 300,\n  formatted: false, // default is true\n  maxMemoryLimit: 20 * 1048576, // should not pass of 20MB\n  maxMemoryPercentThreshold: 90, // should not pass 90% of total memory\n  waitUntil: ['domContentLoaded'], // wait for browser events\n}\n\nmemoryInspector(config).then((info) =\u003e console.log(info))\n\n/*\n{ usedJSHeapSize: 10000000,\n  totalJSHeapSize: 11900000,\n  jsHeapSizeLimit: 2190000000,\n  memoryUsagePercent: 438000000,\n  exceededMemoryMaximum: -10971520,\n  exceededMemoryUsagePercent: false }\n*/\n\n```\n\n## Config\n\n#### url\n\n`\u003cstring\u003e` URL to navigate page to. The url should include scheme, e.g. `https://`\n\n#### formatted\n\n`\u003cboolean\u003e` Define if will format bytes into sizes, like: `2190000000` to `2.19 GB`. By default it's `true`.\n\n#### delay\n\n`\u003cnumber\u003e` Slows down report by the specified amount of milliseconds.\n\n#### maxMemoryLimit\n\n`\u003cnumber\u003e` Sets maximum memory limit which can be used by application, it will reflect on `exceededMemoryMaximum` report.\n\n#### maxMemoryPercentThreshold\n\n`\u003cnumber\u003e` Sets maximum memory percent threshold on application, it will reflect on `exceededMemoryUsagePercent` report.\n\n#### waitUntil\n\n`\u003cstring|array\u003cstring\u003e\u003e` When to consider navigation succeeded. Given an array of event strings, navigation is considered to be successful after all events have been fired.\n\n## Roadmap\n\n- [ ] Iterate report operations by configuration\n- [ ] Prediction report\n- [ ] Integrate with Jest\n- [ ] Write decent tests\n- [ ] Allows to specify executable based on Webkit Binaries\n\n## About\n\nA Thanks to [Puppeteer](https://github.com/GoogleChrome/puppeteer).\n\nMade by [Raphael Amorim](https://github.com/raphamorim), Licensed by [MIT](License)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fmemory-inspector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphamorim%2Fmemory-inspector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fmemory-inspector/lists"}