https://github.com/0f-0b figured this out for both Deno and Node.js
https://github.com/denoland/deno/discussions/17236.

On Sun, Jan 1, 2023 at 4:24 AM <v8-users@googlegroups.com> wrote:

> v8-users@googlegroups.com
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/v8-users/topics>
>  Google
> Groups
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview>
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview>
> Topic digest
> View all topics
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/v8-users/topics>
>
>    - Any recent changes that impact buffering or caching procceses?
>    <#m_2400262473293151249_group_thread_0> - 3 Updates
>
> Any recent changes that impact buffering or caching procceses?
> <http://groups.google.com/group/v8-users/t/b113624bd3c605af?utm_source=digest&utm_medium=email>
> guest271314 <guest271...@gmail.com>: Dec 31 12:11PM -0800
>
> I created Native Messaging hosts in several programming languages
> including
> C, C++, JavaScript. In JavaScript I created a host specific to QuickJS,
> Node.js, Deno. Node.js and Deno depend on V8. I use the same call in the
> extension to create hosts
>
> globalThis.name = chrome.runtime.getManifest().short_name;
>
> globalThis.port = chrome.runtime.connectNative(globalThis.name);
> port.onMessage.addListener((message) => console.log(message));
> port.onDisconnect.addListener((p) =>
> console.log(chrome.runtime.lastError));
> port.postMessage(new Array(200000));
>
> chrome.runtime.onInstalled.addListener((reason) => {
> console.log(reason);
> });
>
> The same code used to work on Chromium Dev Channel. Now the V8 JavaScript
> engine-specific versions increase memory usage exponentially to upwards of
> 1GB, then exit.
>
> The input is echoed when the input array is 2000.
>
> Appears to be some kind of caching or process blocking. I am not sure
> though.
>
> Any recent changes that impact buffering or caching procceses?
> guest271314 <guest271...@gmail.com>: Dec 31 02:35PM -0800
>
> Appears to be a memory leak in Node.js and Deno when input to stdin
> (and/or
> stdout) is greater than 4096*3. node executable memory usage climbs to
> 700MB+ then exits when input is new Array(4096*4).
>
> Are there any V8 flags I can use to work around this?
>
> On Saturday, December 31, 2022 at 12:11:16 PM UTC-8 guest271314 wrote:
>
> guest271314 <guest271...@gmail.com>: Dec 31 07:31PM -0800
>
> After more testing I narrow the input to stdin length for memory to
> increase pointing to Node.js and Deno executables to when I call this in
> the browser
> port.postMessage(new Array((4096*3)+818));
>
> 65531
>
> is written to log.txt, which is expected
> JSON.stringify(new Array((4096*3)+818)).length // 65531
>
> when I add 1 to that input array
> port.postMessage(new Array((4096*3)+819));
>
> 1567386741
>
> is written to log.txt.
> The relevant Node.js code
>
> function getMessage() {
> const header = new Uint32Array(1);
> readSync(0, header);
> const content = new Uint8Array(header[0]);
> writeFileSync('log.txt', JSON.stringify(header[0]));
> readSync(0, content);
> return content;
> }
>
> and Deno code
>
> async function getMessage() {
> const header = new Uint32Array(1);
> await Deno.stdin.read(header);
> await Deno.writeTextFile("log.txt", header[0]);
> const output = new Uint8Array(header[0]);
> await Deno.stdin.read(output);
> return output;
> }
> On Saturday, December 31, 2022 at 2:35:32 PM UTC-8 guest271314 wrote:
>
> Back to top <#m_2400262473293151249_digest_top>
> You received this digest because you're subscribed to updates for this
> group. You can change your settings on the group membership page
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/v8-users/join>
> .
> To unsubscribe from this group and stop receiving emails from it send an
> email to v8-users+unsubscr...@googlegroups.com.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CA%2BsyWAMBs8EGwowKJswE0bHaNu8hvdK9-vueR0gtn0XEXmuZ9A%40mail.gmail.com.

Reply via email to