Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Memory keeps rising #129

Closed
vaibhawc opened this issue Sep 17, 2016 · 5 comments
Closed

Memory keeps rising #129

vaibhawc opened this issue Sep 17, 2016 · 5 comments

Comments

@vaibhawc
Copy link

vaibhawc commented Sep 17, 2016

Hi @wkh237, it feels good to see this library being used and liked. Thanks.
I have been facing an issue lately, where the memory keeps rising in steps even when I am finished using the library. On another instance it does not happen while I am not using uploadProgress.
I am basically trying to make a messaging app where user can upload files (mostly never even 1 MB) and while it is uploading he can see a progress bar like it is there in whatsapp.
Do you think there might be something in the library that can cause such a problem?
I tried 0.9.3,0.9.4, and now going to try the later versions of 0.9.4-beta.4 , beta.7, & 0.9.5 etc.
Do you suggest some things to keep in mind while uploading and observing progress?

@wkh237
Copy link
Owner

wkh237 commented Sep 18, 2016

Hi @vaibhawc , it's been a while since last time 😏 I think the problem is caused by native module. I'll look into it, hope I can figure out this asap. Besides, does it happens on both Android and IOS ?

@wkh237
Copy link
Owner

wkh237 commented Sep 18, 2016

@vaibhawc , I've done some tests on IOS devices which are basically upload files simutaneously. Perhaps it's related to a change in 0.9.4.

Due to some providers does not support the encoding #94 we disabled Chunked transfer encoding by default after 0.9.4.

Here's the result when use Chunked encoding, upload 100 files (each file is ~6MB, 10 files each time), the memory usage is around 35MB(initial) to 45MB.

ios-6mb-multi

this is how I use it

RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/upload`, {
          'Transfer-Encoding' : 'Chunked'
        }, RNFetchBlob.wrap(file))
        .uploadProgress((current, total) => {})
        .then(() => {
           ....
        })

And here's the diagram from XCode instrument leaks inspector, looks fine 👍

2016-09-18 4 45 56

However, if I disable Chunked encoding, the memory usage will become relatively high and there're also some leaks, but there's no our code in the call tree, I'll try to figure it out

2016-09-18 4 50 49

@vaibhawc
Copy link
Author

vaibhawc commented Sep 18, 2016

Hi @wkh237, this is some informative piece I just skipped before. I am doing some more testing and let you know. (need to be sure there isn't some other piece of code causing problem)

@wkh237
Copy link
Owner

wkh237 commented Sep 19, 2016

@vaibhawc , could you try to replace the uploadProgress with an empty function ?

.uploadProgress(()=>{})

If you update GUI in the upload progress handler and it triggers at high frequency , it's also possible becomes a quite performance overhead

@vaibhawc
Copy link
Author

Hey @wkh237, I am very sorry I am late to reply as I had forgotten about the thread. I faced another question and realized this issue is still open. Also, the problem here was with my code only. But thanks, you took out time to diligently test it out and explain things I would have skipped otherwise.
There is another query (not an issue) that I have, but I will have to open it as an issue.

zombierabbit pushed a commit to zombierabbit/react-native-fetch-blob that referenced this issue Feb 12, 2019
improvement way to get root SDK versions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants