bertrandmartel / speed-test-lib

:cloud: JSpeedTest : speed test client library for Java/Android
MIT License
381 stars 119 forks source link

Crash when uploading(set file size) #27

Closed DimaDDM closed 7 years ago

DimaDDM commented 7 years ago

For example. When i'm trying upload 100MB file app catch OOM.

FATAL EXCEPTION: pool-7-thread-1 java.lang.OutOfMemoryError at fr.bmartel.speedtest.utils.RandomGen.generateRandomArray(RandomGen.java:59) at fr.bmartel.speedtest.SpeedTestTask$7.run(SpeedTestTask.java:990) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)

bertrandmartel commented 7 years ago

This is because the random byte array to be uploaded is generated before the upload starts, to avoid the generation to be included into the speed test time.

I could create some chunks of random byte array before each socket write and exclude the time taken by the generation of these array but it would imply to suspend the speed test timing (and should still be compatible with fixed upload time).

Thank you for reporting this, I will try to find a way to deal with both issues

DimaDDM commented 7 years ago

Thanks