Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: Cannot create a string longer than 0x1fffffe8 characters" #197

Open
thbar opened this issue Jan 27, 2024 · 1 comment
Open

"Error: Cannot create a string longer than 0x1fffffe8 characters" #197

thbar opened this issue Jan 27, 2024 · 1 comment

Comments

@thbar
Copy link

thbar commented Jan 27, 2024

I think I stumbled upon a technical limitation while comparing large (but similar to a very large extend) CSV files.

❯ daff 80921.20240125.120915.280075/stop_times.txt 80921.20240125.180818.104400/stop_times.txt
/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:11375
                throw(e);
                ^

Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (node:buffer:599:37)
    at Buffer.toString (node:buffer:819:14)
    at Object.readFileSync (node:fs:506:41)
    at Object.tio.getContent (/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:11195:15)
    at $hx_exports.coopy.Coopy.loadTable (/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:2359:21)
    at $hx_exports.coopy.Coopy.run (/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:2933:17)
    at $hx_exports.coopy.Coopy.coopyhx (/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:3014:15)
    at run_daff_base (/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:11326:18)
    at Object.daff.run_daff_main (/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:11343:13)
    at Object.<anonymous> (/Users/thbar/.asdf/installs/nodejs/16.17.1/lib/node_modules/daff/bin/daff.js:11361:11) {
  code: 'ERR_STRING_TOO_LONG'
}

The files are closer from 750MB, and the limit seems to be around 0x1fffffe8 = 512MB.

I wonder if this is can be fixed easily or not !

@thbar
Copy link
Author

thbar commented Jan 27, 2024

Ha! Looks like I hit buffer.constants.MAX_STRING_LENGTH 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant