@depup/node-memwatch 1.0.1-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,161 @@
1
+ # This file is generated by gyp; do not edit.
2
+
3
+ TOOLSET := target
4
+ TARGET := memwatch
5
+ DEFS_Debug := \
6
+ '-DNODE_GYP_MODULE_NAME=memwatch' \
7
+ '-DUSING_UV_SHARED=1' \
8
+ '-DUSING_V8_SHARED=1' \
9
+ '-DV8_DEPRECATION_WARNINGS=1' \
10
+ '-D_GLIBCXX_USE_CXX11_ABI=1' \
11
+ '-D_FILE_OFFSET_BITS=64' \
12
+ '-D_LARGEFILE_SOURCE' \
13
+ '-D__STDC_FORMAT_MACROS' \
14
+ '-DOPENSSL_NO_PINSHARED' \
15
+ '-DOPENSSL_THREADS' \
16
+ '-DBUILDING_NODE_EXTENSION' \
17
+ '-DDEBUG' \
18
+ '-D_DEBUG'
19
+
20
+ # Flags passed to all source files.
21
+ CFLAGS_Debug := \
22
+ -fPIC \
23
+ -pthread \
24
+ -Wall \
25
+ -Wextra \
26
+ -Wno-unused-parameter \
27
+ -m64 \
28
+ -g \
29
+ -O0
30
+
31
+ # Flags passed to only C files.
32
+ CFLAGS_C_Debug :=
33
+
34
+ # Flags passed to only C++ files.
35
+ CFLAGS_CC_Debug := \
36
+ -fno-rtti \
37
+ -fno-exceptions \
38
+ -fno-strict-aliasing \
39
+ -std=gnu++20
40
+
41
+ INCS_Debug := \
42
+ -I/home/runner/.cache/node-gyp/24.14.0/include/node \
43
+ -I/home/runner/.cache/node-gyp/24.14.0/src \
44
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/openssl/config \
45
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/openssl/openssl/include \
46
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/uv/include \
47
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/zlib \
48
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/v8/include \
49
+ -I$(srcdir)/node_modules/nan
50
+
51
+ DEFS_Release := \
52
+ '-DNODE_GYP_MODULE_NAME=memwatch' \
53
+ '-DUSING_UV_SHARED=1' \
54
+ '-DUSING_V8_SHARED=1' \
55
+ '-DV8_DEPRECATION_WARNINGS=1' \
56
+ '-D_GLIBCXX_USE_CXX11_ABI=1' \
57
+ '-D_FILE_OFFSET_BITS=64' \
58
+ '-D_LARGEFILE_SOURCE' \
59
+ '-D__STDC_FORMAT_MACROS' \
60
+ '-DOPENSSL_NO_PINSHARED' \
61
+ '-DOPENSSL_THREADS' \
62
+ '-DBUILDING_NODE_EXTENSION'
63
+
64
+ # Flags passed to all source files.
65
+ CFLAGS_Release := \
66
+ -fPIC \
67
+ -pthread \
68
+ -Wall \
69
+ -Wextra \
70
+ -Wno-unused-parameter \
71
+ -m64 \
72
+ -O3 \
73
+ -fno-omit-frame-pointer
74
+
75
+ # Flags passed to only C files.
76
+ CFLAGS_C_Release :=
77
+
78
+ # Flags passed to only C++ files.
79
+ CFLAGS_CC_Release := \
80
+ -fno-rtti \
81
+ -fno-exceptions \
82
+ -fno-strict-aliasing \
83
+ -std=gnu++20
84
+
85
+ INCS_Release := \
86
+ -I/home/runner/.cache/node-gyp/24.14.0/include/node \
87
+ -I/home/runner/.cache/node-gyp/24.14.0/src \
88
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/openssl/config \
89
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/openssl/openssl/include \
90
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/uv/include \
91
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/zlib \
92
+ -I/home/runner/.cache/node-gyp/24.14.0/deps/v8/include \
93
+ -I$(srcdir)/node_modules/nan
94
+
95
+ OBJS := \
96
+ $(obj).target/$(TARGET)/src/heapdiff.o \
97
+ $(obj).target/$(TARGET)/src/init.o \
98
+ $(obj).target/$(TARGET)/src/memwatch.o \
99
+ $(obj).target/$(TARGET)/src/util.o
100
+
101
+ # Add to the list of files we specially track dependencies for.
102
+ all_deps += $(OBJS)
103
+
104
+ # CFLAGS et al overrides must be target-local.
105
+ # See "Target-specific Variable Values" in the GNU Make manual.
106
+ $(OBJS): TOOLSET := $(TOOLSET)
107
+ $(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
108
+ $(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
109
+
110
+ # Suffix rules, putting all outputs into $(obj).
111
+
112
+ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
113
+ @$(call do_cmd,cxx,1)
114
+
115
+ # Try building from generated source, too.
116
+
117
+ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
118
+ @$(call do_cmd,cxx,1)
119
+
120
+ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
121
+ @$(call do_cmd,cxx,1)
122
+
123
+ # End of this set of suffix rules
124
+ ### Rules for final target.
125
+ LDFLAGS_Debug := \
126
+ -pthread \
127
+ -rdynamic \
128
+ -m64
129
+
130
+ LDFLAGS_Release := \
131
+ -pthread \
132
+ -rdynamic \
133
+ -m64
134
+
135
+ LIBS :=
136
+
137
+ $(obj).target/memwatch.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
138
+ $(obj).target/memwatch.node: LIBS := $(LIBS)
139
+ $(obj).target/memwatch.node: TOOLSET := $(TOOLSET)
140
+ $(obj).target/memwatch.node: $(OBJS) FORCE_DO_CMD
141
+ $(call do_cmd,solink_module)
142
+
143
+ all_deps += $(obj).target/memwatch.node
144
+ # Add target alias
145
+ .PHONY: memwatch
146
+ memwatch: $(builddir)/memwatch.node
147
+
148
+ # Copy this to the executable output path.
149
+ $(builddir)/memwatch.node: TOOLSET := $(TOOLSET)
150
+ $(builddir)/memwatch.node: $(obj).target/memwatch.node FORCE_DO_CMD
151
+ $(call do_cmd,copy)
152
+
153
+ all_deps += $(builddir)/memwatch.node
154
+ # Short alias for building this executable.
155
+ .PHONY: memwatch.node
156
+ memwatch.node: $(obj).target/memwatch.node $(builddir)/memwatch.node
157
+
158
+ # Add executable to "all" target.
159
+ .PHONY: all
160
+ all: $(builddir)/memwatch.node
161
+
package/changes.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "bumped": {
3
+ "bindings": {
4
+ "from": "^1.2.1",
5
+ "to": "^1.5.0"
6
+ },
7
+ "nan": {
8
+ "from": "^2.3.2",
9
+ "to": "^2.26.2"
10
+ }
11
+ },
12
+ "timestamp": "2026-03-19T03:30:26.559Z",
13
+ "totalUpdated": 2
14
+ }
@@ -0,0 +1,22 @@
1
+ const
2
+ memwatch = require('..'),
3
+ url = require('url');
4
+
5
+ function LeakingClass() {
6
+ }
7
+
8
+ memwatch.gc();
9
+
10
+ var arr = [];
11
+
12
+ var hd = new memwatch.HeapDiff();
13
+
14
+ for (var i = 0; i < 10000; i++) arr.push(new LeakingClass);
15
+
16
+ var hde = hd.end();
17
+
18
+ console.log(JSON.stringify(hde, null, 2));
19
+
20
+
21
+
22
+
@@ -0,0 +1,16 @@
1
+ // a trivial process that does nothing except
2
+ // trigger GC and output the present base memory
3
+ // usage every second. this example is intended to
4
+ // demonstrate that memwatch itself does not leak.
5
+
6
+ var memwatch = require('../');
7
+
8
+ memwatch.on('gc', function(d) {
9
+ if (d.compacted) {
10
+ console.log('current base memory usage:', memwatch.stats().current_base);
11
+ }
12
+ });
13
+
14
+ setInterval(function() {
15
+ memwatch.gc();
16
+ }, 1000);
@@ -0,0 +1,61 @@
1
+ // a trivial process that does nothing except
2
+ // trigger GC and output the present base memory
3
+ // usage every second. this example is intended to
4
+ // demonstrate that memwatch itself does not leak.
5
+
6
+ var http = require('http');
7
+
8
+ var start = new Date();
9
+ function msFromStart() {
10
+ return new Date() - start;
11
+ }
12
+
13
+ var leak = [];
14
+
15
+ // every second, this program "leaks" a little bit
16
+ setInterval(function() {
17
+ for (var i = 0; i < 10; i++) {
18
+ var str = i.toString() + " on a stick, short and stout!";
19
+ leak.push(str);
20
+ }
21
+ }, 1000);
22
+
23
+ // meantime, the program is busy, doing *lots* of http requests
24
+ var http = require('http');
25
+ http.createServer(function (req, res) {
26
+ res.writeHead(200, {'Content-Type': 'text/plain'});
27
+ res.end('Hello World\n');
28
+ }).listen(1337, '127.0.0.1');
29
+
30
+ function doHTTPRequest() {
31
+ var options = {
32
+ host: '127.0.0.1',
33
+ port: 1337,
34
+ path: '/index.html'
35
+ };
36
+
37
+ http.get(options, function(res) {
38
+ setTimeout(doHTTPRequest, 300);
39
+ }).on('error', function(e) {
40
+ setTimeout(doHTTPRequest, 300);
41
+ });
42
+ }
43
+
44
+ doHTTPRequest();
45
+ doHTTPRequest();
46
+
47
+ var memwatch = require('../');
48
+
49
+ // report to console postgc heap size
50
+ memwatch.on('stats', function(d) {
51
+ console.log("postgc:", msFromStart(), d.current_base);
52
+ });
53
+
54
+ memwatch.on('leak', function(d) {
55
+ console.log("LEAK:", d);
56
+ });
57
+
58
+ // also report periodic heap size (every 10s)
59
+ setInterval(function() {
60
+ console.log("naive:", msFromStart(), process.memoryUsage().heapUsed);
61
+ }, 5000);
package/include.js ADDED
@@ -0,0 +1,16 @@
1
+ const
2
+ magic = require('bindings')('memwatch'),
3
+ events = require('events');
4
+
5
+ module.exports = new events.EventEmitter();
6
+
7
+ module.exports.gc = magic.gc;
8
+ module.exports.HeapDiff = magic.HeapDiff;
9
+
10
+ magic.upon_gc(function(has_listeners, event, data) {
11
+ if (has_listeners) {
12
+ return (module.exports.listeners('stats').length > 0);
13
+ } else {
14
+ return module.exports.emit(event, data);
15
+ }
16
+ });
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@depup/node-memwatch",
3
+ "description": "Keep an eye on your memory usage, and discover and isolate leaks. (with updated dependencies)",
4
+ "version": "1.0.1-depup.0",
5
+ "author": "Lloyd Hilaiel (http://lloyd.io)",
6
+ "engines": {
7
+ "node": ">= 9"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/eduardbcom/node-memwatch.git"
12
+ },
13
+ "main": "include.js",
14
+ "licenses": [
15
+ {
16
+ "type": "wtfpl"
17
+ }
18
+ ],
19
+ "bugs": {
20
+ "url": "https://github.com/eduardbcom/node-memwatch/issues"
21
+ },
22
+ "scripts": {
23
+ "test": "mocha tests --reporter spec"
24
+ },
25
+ "devDependencies": {
26
+ "mocha": "^2.4.5",
27
+ "should": "^8.3.1"
28
+ },
29
+ "contributors": [
30
+ "Jed Parsons (@jedp)",
31
+ "Jeff Haynie (@jhaynie)",
32
+ "Justin Matthews (@jmatthewsr-ms)",
33
+ "Eduard Bondarenko (@eduardbcom)"
34
+ ],
35
+ "dependencies": {
36
+ "bindings": "^1.5.0",
37
+ "nan": "^2.26.2"
38
+ },
39
+ "keywords": [
40
+ "node-memwatch",
41
+ "depup",
42
+ "updated-dependencies",
43
+ "security",
44
+ "latest",
45
+ "patched"
46
+ ],
47
+ "depup": {
48
+ "changes": {
49
+ "bindings": {
50
+ "from": "^1.2.1",
51
+ "to": "^1.5.0"
52
+ },
53
+ "nan": {
54
+ "from": "^2.3.2",
55
+ "to": "^2.26.2"
56
+ }
57
+ },
58
+ "depsUpdated": 2,
59
+ "originalPackage": "node-memwatch",
60
+ "originalVersion": "1.0.1",
61
+ "processedAt": "2026-03-19T03:30:40.639Z",
62
+ "smokeTest": "failed"
63
+ }
64
+ }