As you are working using a loop, you need to do something to release memory as all the memory is used before your application is no longer busy for the OS to clear it.
I didn’t say it wasn’t imageviewer, but just saying something is and then offering no proof and no way for others to test it exactly as you’ve done it means we can’t help prove it one way or the other.
We’re just trying to help or help corroborate your findings. If you didn’t want that, just say so.
I would like to point out that the original code and this code is the reason we were questioning things. You said twice that p was a memoryblock. Since you can’t assign a memoryblock directly to an Imageviewer, we wanted to see the code. It was only later that you said that you were loading the memoryblock into a picture first.
I am at 3,280 downloaded pdf files and the SSD have only 8GB of free rooms… usually, I have to reboot at less than 1,000 files and around 10/12 GB of free rooms in the SSD.
As I wrote earlier, once i stopped using the ImageViewer, there was no more memory leak.
Sorry for that, I think that I demonstrate where the leak is and do not think it mattered to know from where the picture comes (I saved p using a BinaryStream to disk as pdf file) matters in any way.
To be crystal clear, p is still saved to disk, so the leak does not comes from the MemoryBlock nor from the URLConnection.
Of course, I can be wrong and get an erroneous conclusion.