Created attachment 38514 [details] outputEscapedString consumed alot of memory When a large text excel cell is generating, every codepoint is accessed and it was converted to a new String. These logic can consume alot of memory. Is there any optimization for this ?
May I ask why you are putting massive strings in individual cells? I see little point in optimising POI memory usage in this case. The code point util code here solves a real world problem (support for UTF-8 surrogate chars). It's not a problem that many users will hit but I'd prefer the code handles it. In theory, we could allow the setting of a flag on SXSSFWorkbook that disables this use of CodepointUtil (opt out). If you were to produce a PR or patch like this, I would consider merging it.
Also, all the small strings created by code point util should be garbage collectable as soon as they are iterated over - so if you run into memory trouble, the garbage collector should be able to claim back a lot of this memory. The original large string value for the Cell will still be needed though.