googlearchive / poly-toolkit-unity

Poly Toolkit for Unity
Apache License 2.0
101 stars 29 forks source link

Buffering the concurrent downloads allocates about 1gb of memory, which is a lot for a mobile platform. #4

Closed sessa closed 6 years ago

sessa commented 6 years ago

Given there are 8 MAX_CONCURRENT_DOWNLOADS being allocated 128 mb via the DATA_BUFFER_INIT_SIZE , this gets us to ~ 1gb.

For a mobile platform this is too much and I believe both the # of MAX_CONCURRENT_DOWNLOADS and the DATA_BUFFER_INIT_SIZE should be configurable?

btco commented 6 years ago

That's a good point. 1GB is OK for desktop but seems a bit much for a mobile platforms. We'll take a look into it for next release.

iBicha commented 6 years ago

Any news about this?

btco commented 6 years ago

Not yet, it's taking me a while because I want to do this at the same time as I fix some issues with the code in Unity 2018, that way I can make a single bugfix release. Sorry for the delay!

For now, as a workaround, you can go in the code and change the value of MAX_CONCURRENT_DOWNLOADS and DATA_BUFFER_INIT_SIZE.

iBicha commented 6 years ago

Thank you for the hint! Althougth now that you pointed me to this direction, I couldn't help but notice a couple of things: 1-It says buffers are reallocated on the main thread, while I don't think there's a reason for that 2-BufferHolder.tempBuffer and BufferHolder.dataBuffer are used nowhere in the project.

btco commented 6 years ago

I removed the unnecessary buffers. They were obsolete (were left over from a previous implementation).