mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
task: allocate callback on heap immediately in debug mode (#4203)
This commit is contained in:
@@ -193,7 +193,11 @@ impl Handle {
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
self.spawn_blocking_inner(func, None)
|
||||
if cfg!(debug_assertions) && std::mem::size_of::<F>() > 2048 {
|
||||
self.spawn_blocking_inner(Box::new(func), None)
|
||||
} else {
|
||||
self.spawn_blocking_inner(func, None)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
|
||||
Reference in New Issue
Block a user