Hi! Does anybody know how big String can be in Kot...
# multiplatform
m
Hi! Does anybody know how big String can be in Kotlin? Right now I am passing strings that are ~40KB without problems but I am concerned about how far can I go before I have to implement a buffer of some sort 🤔
t
I would guess it's platform dependent. ChatGPT says 2 GB for JVM, 1 GB for JS and "who knows" for Native. It also says that performance will degrade with big ones which is reasonable. I would guess when you simply pass the strings it doesn't really matter. Processing it is a different matter.
🙏 1
e
constant strings are limited to roughly 64k ascii or 32k unicode on JVM, due to classfile format restrictions
runtime strings can be as big as memory allows, which may vary
🙏 1