donmor / Tiddloid

Tiddloid is an app to work with locally stored TiddlyWikis.
GNU General Public License v2.0
234 stars 10 forks source link

Fix/oom #64

Closed linonetwo closed 1 year ago

linonetwo commented 1 year ago

ChatGPT 说可以

OutputStream os = new FileOutputStream(ofd.getFileDescriptor());
        InputStream inputStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
        byte[] buffer = new byte[1024];
        int read;
        while ((read = inputStream.read(buffer)) != -1) {
            os.write(buffer, 0, read);
        }
        os.flush();
        os.close();

但是你这先存成员变量再另一个地方用,我不知道咋整了。

还有 ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); 难道不会在调 data.getBytes 的时候就 OOM吗? 反正我觉得不靠谱。

还是加个 android:largeHeap="true" 简单