Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak #3897

Closed
zhuxiujia opened this issue Mar 1, 2020 · 9 comments
Closed

memory leak #3897

zhuxiujia opened this issue Mar 1, 2020 · 9 comments
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: Memory Management Bugs/feature requests, that are related to the memory management of the compiler. Unit: vweb Bugs/feature requests, that are related to the `vweb`.
Milestone

Comments

@zhuxiujia
Copy link

zhuxiujia commented Mar 1, 2020

// blog.v
module main

import (
	vweb
)

pub struct App {
mut:
	vweb vweb.Context
}

fn main() {
	vweb.run<App>(8080)
}

fn (app mut App) index() {
	app.vweb.text('Hello, world from vweb!')
}

pub fn (app &App) init() {}
pub fn (app &App) reset() {}
  • v run http.v
    building-a-simple-web-blog-with-vweb.md

  • in windows10 request http://127.0.0.1:8080/ every request this, the The memory grows by 0.1 MB

  • this is rust request test, also you can use go,java or other lang to request this

use hyper::Uri;
use rsd::http_client::{fetch_url, fetch_url_client};
use rsd::time_util::count_time_tps;
use std::time::{SystemTime, Duration};
use std::thread::sleep;


//cargo.exe run --release --color=always --package example --bin benchmark
#[tokio::main]
pub async fn main(){
    let client=hyper::Client::new();
    let s=fetch_url_client("POST","http://127.0.0.1:8080/","",&client).await.unwrap();
    println!("{}",s);


    let total=100000;
    let now=SystemTime::now();
    for _ in 0..total{
         sleep(Duration::from_secs(1));
         for _ in 0..100{
             fetch_url_client("POST","http://127.0.0.1:8080/","",&client).await.unwrap();
         }
    }
    count_time_tps(total,now);
}
@zhuxiujia zhuxiujia added the Bug This tag is applied to issues which reports bugs. label Mar 1, 2020
@M4SSD35TRUCT10N M4SSD35TRUCT10N added this to the Beta Release milestone Apr 5, 2020
@M4SSD35TRUCT10N M4SSD35TRUCT10N added the Unit: vweb Bugs/feature requests, that are related to the `vweb`. label Apr 5, 2020
@antonkatz
Copy link

I can confirm that this is still happening, albeit at 4K per request, not 100K.

V 0.1.29 3b5d562 on Mac

@smartiniOnGitHub
Copy link
Contributor

Weeks ago (with previous V version) I had the same behavior (memory leak) doing a test of concurrent load using the utility Apache Bench ('ab' executable, part of the Apache Web Server), and even with the load testing utility WRK (it seems more accurate); all running in Ubuntu 20.04 LTS.
I think it's still present in current V version.
Hope this helps simplifying some tests, otherwise tell me so I can repeat my tests.

@antonkatz
Copy link

Interestingly enough, in my own code (not this example) on my home Linux machine, page reloads don't seem to change the amount of memory that I see through top. But, doing a POST curl makes the memory grow by about 0.1M

@zhuxiujia
Copy link
Author

Interestingly enough, in my own code (not this example) on my home Linux machine, page reloads don't seem to change the amount of memory that I see through top. But, doing a POST curl makes the memory grow by about 0.1M

This means that the problem is with Windows and MacOS?

@medvednikov
Copy link
Member

No, the problem is in V, I'm fixing it.

@nedpals nedpals added the Unit: Memory Management Bugs/feature requests, that are related to the memory management of the compiler. label Nov 30, 2020
@smartiniOnGitHub
Copy link
Contributor

smartiniOnGitHub commented Dec 20, 2020

Hi guys and thanks for the great work you're doing on the whole language.
I'm sorry to say that I'm repeating some tests with updated V on a minimal vweb example (you can find it here) and still I see memory grow each request (without and even with '-autofree'); just tried to understand something better with Valgrind and there are some memory leaks; sorry but can't say much more ... anyway tell me if I can help on something, at least to provide more data.

@LouisSchmieder
Copy link
Member

I think some tests are good, but it should be fixed soon

@kolesar-andras
Copy link

Memory still leaks in V 0.2.4 61b99e1.

@medvednikov
Copy link
Member

Fixed in 0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: Memory Management Bugs/feature requests, that are related to the memory management of the compiler. Unit: vweb Bugs/feature requests, that are related to the `vweb`.
Projects
None yet
Development

No branches or pull requests

8 participants