Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@nearform/heap-profiler
Advanced tools
Readme
Heap dump and sample profiler generator for Node.
Just run:
npm install @nearform/heap-profiler
Once installed, the profiler can be used as a preloader that adds a listener to SIGUSR2
signal.
If you start your application like this:
node -r @nearform/heap-profiler index.js
Then you will be able make a snapshot, start profiling heap, and start tracking allocation timeline by sending the process a SIGUSR2 signal, like this:
kill -USR2 $PID
Heap snapshot will be generated immediately.
Heap sampling profiler and allocation timeline must be stopped, by sending another SIGUSR2 signal to the process.
Then the tool will await on the next signal, to resume profiling/tracking/shooting the heap.
The preloader uses the following environment variables to control its behavior:
HEAP_PROFILER_PRELOADER_DISABLED
: If set to true
, the preloader is not installed and you need to use the API to sample the process.
HEAP_PROFILER_SNAPSHOT
: If set to false
, it will not generate heap dump snapshots.
HEAP_PROFILER_SNAPSHOT_DESTINATION
: The path where to store the snapshot. The default will be a .heapsnapshot
in the current directory.
HEAP_PROFILER_SNAPSHOT_RUN_GC
: If to run the garbage collector before taking the snapshot. The default is false
and it is ignored if the process is not started with the --expose-gc
flag.
HEAP_PROFILER_PROFILE
: If set to false
, it will not generate heap sampling profile.
HEAP_PROFILER_PROFILE_DESTINATION
: The path where to store the profile. The default will be a .heapprofile
in the current directory.
HEAP_PROFILER_PROFILE_INTERVAL
: Heap sampling profile interval, in bytes. Default is 32768
(32KB).
HEAP_PROFILER_TIMELINE
: If set to false
, it will not start tracking timeline allocation.
HEAP_PROFILER_TIMELINE_DESTINATION
: The path where to store the allocation timeline. The default will be a .heaptimeline
in the current directory.
HEAP_PROFILER_TIMELINE_RUN_GC
: Whether or not running Garbage Collector before and after the allocation timeline, to see only remaining objects (default to false).
HEAP_PROFILER_LOGGING_DISABLED
: If set to true
, it will disable logging.
All module functions can be used with promises and by providing a callback as last option.
The promise resolved value (or the callback argument) will be the generated file path.
The available functions are:
generateHeapSnapshot([options], [callback]): [Promise]
: Generates a heap dump
destination
: The path where to store the snapshot. The default will be a .heapsnapshot
in the current directory.runGC
: If to run the garbage collector before taking the snapshot. The default is false
and it is ignored if the process is not started with the --expose-gc
flag.generateHeapSamplingProfile([options], [callback]): [Promise]
: Starts generating a heap sampling profiler. The valid options are:
destination
: The path where to store the profile. The default will be a .heapprofile
in the current directory.interval
: Sample interval, in bytes. Default is 32768
(32KB).duration
: Sample duration, in milliseconds. Default is 10000
(10 seconds), and it is ignored if signal
is provided.signal
: The AbortController signal
to use to stop the operation.The function accepts a callback function, otherwise it returns a Promise. The resolved value (or the callback argument) will be the generated file path.
recordAllocationTimeline([options], [callback]): [Promise]
: Starts recording allocation on heap. The valid options are:
destination
: The path where to store the timeline. The default will be a .heaptimeline
in the current directory.runGC
: If to run the garbage collector at the begining and the end of the timeline. The default is false
and it is ignored if the process is not started with the --expose-gc
flag.duration
: Recording duration, in milliseconds. Default is 10000
(10 seconds), and it is ignored if signal
is provided.signal
: The AbortController signal
to use to stop the operation.The function accepts a callback function, otherwise it returns a Promise. The resolved value (or the callback argument) will be the generated file path.
Generating a heap dump snapshot is handled synchronously by Node and therefore will block your process completely.
Generating a heap sampling profile or record allocation timeline is instead asynchronous and lightweight. Our test showed that the performance decrease is around 10%.
See CONTRIBUTING.md
Copyright NearForm Ltd 2020. Licensed under the Apache-2.0 license.
FAQs
Heap dump, sample profiler and allocation timeline generator for Node.
The npm package @nearform/heap-profiler receives a total of 20,533 weekly downloads. As such, @nearform/heap-profiler popularity was classified as popular.
We found that @nearform/heap-profiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 34 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.