High memory usage in vibe.d application

Anton Fediushin fediushin.anton at yandex.com
Sun Jul 1 13:44:23 UTC 2018


On Sunday, 1 July 2018 at 12:32:25 UTC, Jacob Shtokolov wrote:
> On Sunday, 1 July 2018 at 05:20:17 UTC, Anton Fediushin wrote:
>> Now I tried it and indeed, it's vibe.d's fault. I'm not quite 
>> sure what causes it and if this problem is known, I'll look 
>> into that later and open an issue if it doesn't exist already.
>
> Yes, please do this when you have time. That would be really 
> helpful for further vibe.d improvement.
>
> I remember a pretty old (and closed) bug of HTTP client here:
> https://github.com/vibe-d/vibe.d/issues/1321
>
> So it might be somehow related to this one. Probably something 
> wrong with HTTP client or TLS/SSL related logic. You example 
> code is very good and I was able to reproduce the same issue 
> with the latest stable compiler, so I hope the guys will find 
> the problem.
>
> Thanks!

I reduced the test case to _one_ line:
```
1.seconds.setTimer(() => "http://google.com".requestHTTP((scope 
req) {}, (scope res) {res.disconnect;}), true);
```

What happens is `res.disconnect` doesn't free all of the internal 
buffers, causing leakage. One way to avoid that is to call 
`res.dropBody`, but it isn't always wanted (just like in my 
example).

I submitted an issue: https://github.com/vibe-d/vibe.d/issues/2179


More information about the Digitalmars-d-learn mailing list