GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: specialize OOM check for AIX · nodejs/node@65e9b0f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/addons
    • addon.status
    • stringbytes-external-exceed-max
      • binding.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/addons/addon.status‎

Copy file name to clipboardExpand all lines: test/addons/addon.status
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,3 @@ prefix addons
33
[true] # This section applies to all platforms
44

55
[$system==aix]
6-
# https://github.com/nodejs/build/issues/1820#issuecomment-505998851
7-
# https://github.com/nodejs/node/pull/28469
8-
# https://github.com/nodejs/node/pull/28516
9-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js: SKIP
10-
11-
# https://github.com/nodejs/node/pull/28516
12-
stringbytes-external-exceed-max/test-stringbytes-external-at-max: SKIP
13-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii: SKIP
14-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64: SKIP
15-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary: SKIP
16-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex: SKIP
17-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8: SKIP
18-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2: SKIP
19-
stringbytes-external-exceed-max/test-stringbytes-external-exceed-max: SKIP
Collapse file

‎test/addons/stringbytes-external-exceed-max/binding.cc‎

Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/binding.cc
+31-1Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,42 @@
22
#include <node.h>
33
#include <v8.h>
44

5+
#ifdef _AIX
6+
// AIX allows over-allocation, and will SIGKILL when the allocated pages are
7+
// used if there is not enough VM. Check for available space until
8+
// out-of-memory. Don't allow more then some (large) proportion of it to be
9+
// used for the test strings, so Node & V8 have some space for allocations.
10+
#include <signal.h>
11+
#include <sys/vminfo.h>
12+
13+
static void* Allowed(size_t size) {
14+
blkcnt_t allowedBlocks = psdanger(SIGKILL);
15+
16+
if (allowedBlocks < 1) {
17+
// Already OOM
18+
return nullptr;
19+
}
20+
const size_t BYTES_PER_BLOCK = 512;
21+
size_t allowed = (allowedBlocks * BYTES_PER_BLOCK * 4) / 5;
22+
if (size < allowed) {
23+
return malloc(size);
24+
}
25+
return nullptr;
26+
}
27+
#else
28+
// Other systems also allow over-allocation, but this malloc-and-free approach
29+
// seems to be working for them.
30+
static void* Allowed(size_t size) {
31+
return malloc(size);
32+
}
33+
#endif // _AIX
34+
535
void EnsureAllocation(const v8::FunctionCallbackInfo<v8::Value> &args) {
636
v8::Isolate* isolate = args.GetIsolate();
737
uintptr_t size = args[0]->IntegerValue();
838
v8::Local<v8::Boolean> success;
939

10-
void* buffer = malloc(size);
40+
void* buffer = Allowed(size);
1141
if (buffer) {
1242
success = v8::Boolean::New(isolate, true);
1343
free(buffer);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.