libaums
                                
                                 libaums copied to clipboard
                                
                                    libaums copied to clipboard
                            
                            
                            
                        Delete empty file causes OutOfMemory issue
Hi,
I really like your library and found it very useful.
I'm trying to delete an empty file on Fat32 Mass storage.
I'm getting an OutOfMemory Exception: OutOfMemoryError: Failed to allocate a 124606360 byte allocation with 16773144 free bytes and 109MB until OOM.
I've seen that you've tried to fix it here: https://github.com/magnusja/libaums/commit/36a3d3b3c43eeae6ae8e3f64845200cf3b55c4bb.
In my case I can see that the startCluster is not 0 so you're trying to read untill you reach FAT32_EOF_CLUSTER, but it never happens.
That's my stack trace:
2022-03-16 09:32:23.488 8027-8152/il.co.isrcorp.usbbrowser W/art: Throwing OutOfMemoryError "Failed to allocate a 124606360 byte allocation with 16773144 free bytes and 109MB until OOM"
2022-03-16 09:32:23.495 8027-8152/il.co.isrcorp.usbbrowser E/AndroidRuntime: FATAL EXCEPTION: Thread-2
Process: il.co.isrcorp.usbbrowser, PID: 8027
java.lang.OutOfMemoryError: Failed to allocate a 124606360 byte allocation with 16773144 free bytes and 109MB until OOM
at java.util.Arrays.copyOf(Arrays.java:3231)
at java.util.Arrays.copyOf(Arrays.java:3204)
at java.util.ArrayList.grow(ArrayList.java:249)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:223)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:215)
at java.util.ArrayList.add(ArrayList.java:441)
at me.jahnen.libaums.core.fs.fat32.FAT.getChain$libaums_release(FAT.kt:121)
at me.jahnen.libaums.core.fs.fat32.ClusterChain.
Thanks
So the file is empty but has a chain? Not sure if that is correct ...
Related to https://github.com/magnusja/libaums/issues/112 maybe?
Hi,
No.
I can see that the getChain method being called with startCluster that is bigger than 0.
I can see that currentCluster at the end of this method is always 0, so it goes into infinite loop.
Now I can see that there's some empty files I can delete.
Also I can see that calling move() method actually moves the file from its first folder.
I am experiencing an identical problem. Infinite loop on delete. In my case, the file is very small (about 100 bytes).
Update: This occurred immediately after upgrading from 0.8.0 to 0.9.1. Since the first infinite loop, I have not been able to reproduce it with 0 length or very small files. Perhaps the issue is with 0-length or small files created initially in 0.8.0.
Update 2: Continuing to experience infinite loop when deleting zero length files, so it's not an "old files" problem. Any response to this?
Fixed with v0.9.4