toasterofbread / spmp

A YouTube Music client with a focus on customisation of colours and song metadata. Built with Compose Multiplatform for Android and desktop.
GNU General Public License v3.0
1.09k stars 44 forks source link

Out of memory error in older less powerful android device #387

Open androidghosh opened 2 weeks ago

androidghosh commented 2 weeks ago

Checklist

Steps to reproduce

  1. log in
  2. Download a playlist with168 songs, set default download location to sd card.
  3. after about 60 songs downloaded I see a lot of out of memory error notifications

Expected behavior

no error

Actual behavior

I see a lot of out of memory error notifications and downloads fails one by one

Screenshots / recordings

No response

Logs

java.lang.OutOfMemoryError: Failed to allocate a 4051656 byte allocation with 341968 free bytes and 333KB until OOM, target footprint 201326592, growth limit 201326592
    at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:87)
    at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:71)
    at java.nio.ByteBuffer.allocate(ByteBuffer.java:380)
    at org.jaudiotagger.utils.ShiftData.shiftDataByOffsetToMakeSpace(ShiftData.java:59)
    at org.jaudiotagger.audio.mp4.Mp4TagWriter.writeNoExistingUdtaAtom(Mp4TagWriter.java:854)
    at org.jaudiotagger.audio.mp4.Mp4TagWriter.write(Mp4TagWriter.java:539)
    at org.jaudiotagger.audio.mp4.Mp4FileWriter.writeTag(Mp4FileWriter.java:37)
    at org.jaudiotagger.audio.generic.AudioFileWriter2.write(AudioFileWriter2.java:73)
    at org.jaudiotagger.audio.AudioFileIO.writeFile(AudioFileIO.java:484)
    at org.jaudiotagger.audio.AudioFileIO.write(AudioFileIO.java:207)
    at org.jaudiotagger.audio.AudioFile.commit(AudioFile.java:114)
    at com.toasterofbread.spmp.platform.download.JAudioTaggerMetadataProcessor$addMetadataToLocalSong$2.invokeSuspend(LocalSongMetadataProcessor.kt:115)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)

SpMp version

0.4.1

SpMp platform

Android

OS version

Android 14

Additional information

No response

toasterofbread commented 2 weeks ago

Please test with b7a6260 and f947c42 separately and report the behaviour of each.

Also, what specific device and much memory are we talking about here?