Why does memory allocation behavior change in Node Javascript for large Array objects? (Docker container)

I am running node.js (12.8.4, lts-stretch) in a Docker Desktop Community (, Windows) container. The container has a limit of 2GB of memory. (However, I see the same behavior regardless of how much memory I assign to Docker.)

In node, this statement works as expected:

var a = Array(32 * 1024 * 1024).fill(0);

However, when this statement executes, node starts allocating memory without limit, as if it were stuck in an infinite loop:

var a = Array(32 * 1024 * 1024 + 1).fill(0);

I do not see the above behavior when running node.exe from a Windows PowerShell prompt — only when running a node container (https://hub.docker.com/_/node).

Why does the memory allocation fail to work correctly at 32MB + 1 elements when running node in the container?

Source: Docker Questions