Comments (11)
代码上怎么写的呢?直接用的 example 吗
from rust-tun.
@e1732a364fed run the example first, it can read/write to the tun interface, anything other than that should be your own job.
from rust-tun.
@e1732a364fed run the example first, it can read/write to the tun interface, anything other than that should be your own job.
我是在问,你这个 memory leak 的issue 是由什么代码造成的。你没理解我的意思。比如说,example 的代码是不是就会有你这个 issue 的问题
from rust-tun.
@e1732a364fed run the example first, it can read/write to the tun interface, anything other than that should be your own job.
为什么理解中文如此难呢?你的截图中有中文
from rust-tun.
@e1732a364fed run the example first, it can read/write to the tun interface, anything other than that should be your own job.
我是在问,你这个 memory leak 的issue 是由什么代码造成的。你没理解我的意思。比如说,example 的代码是不是就会有你这个 issue 的问题
不是example代码,按照自己的需要加的,我看能不能提供一个能重现问题的mini-example
from rust-tun.
内存泄露,有定位到具体原因吗
from rust-tun.
这个地方需要判断cached大小,然后在处理数据(图中直接丢弃),否则程序会崩溃
from rust-tun.
一直没有处理,我这里不会崩溃,只是内存泄漏。
from rust-tun.
from rust-tun.
我也感觉这个地方有问题,一直会启动线程。
from rust-tun.
Got the time to look into this lately, the problem is that Queue::poll_read
will fork a new thread if no data is ready, but there might be another thread already polling, which may result in a bunch of threads all stuck in polling, cause a memory leak.
The fix is simple, check if the polling thread is running before creating.
The most important thing is that Queue::poll_read
might fired multiple times even if the previous poll_read
is in Poll::Pending
state.
loop {
// in this case, Queue::poll_read will fire once no more than 10ms, even if no data is available.
tokio::select!{
_ = sleep_10ms() => {},
msg = dev.next() => {},
}
}
from rust-tun.
Related Issues (20)
- Framed send fails with "Socket operation on non-socket" HOT 3
- Drop Fd crash in Android 11 HOT 1
- Nothing happening on macOS HOT 2
- Use library with default gateway
- Could you elaborate on what routing needs to be done for MacOs? HOT 14
- Where is the tun tap frame? HOT 1
- Build error on windows HOT 1
- GRO/GSO on Linux HOT 1
- macOS tun ip cannot be listened by the application
- The synchronous `write` does not work HOT 1
- when change ip addr to new ip addr, but subnet broadcast address no change, in macos m1 HOT 1
- Windows support can be achieved in this fork
- Add serde pls HOT 1
- Help with multithreading, read and write. HOT 2
- Add support to construct `TunPacket` from `Bytes` directly. HOT 1
- Enable TCP Segmentation Offload (TSO)
- add split api?
- ioctl is marked as "deprecated", should be replaced with nix HOT 1
- Project co-author recruitment HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-tun.