Allocate large futures on the heap
diff --git a/src/task.rs b/src/task.rs
index a300d63..0c57a85 100644
--- a/src/task.rs
+++ b/src/task.rs
@@ -55,7 +55,14 @@
     S: Fn(Task<T>) + Send + Sync + 'static,
     T: Send + Sync + 'static,
 {
-    let raw_task = RawTask::<F, R, S, T>::allocate(future, schedule, tag);
+    // Allocate large futures on the heap.
+    let raw_task = if mem::size_of::<F>() >= 2048 {
+        let future = alloc::boxed::Box::pin(future);
+        RawTask::<_, R, S, T>::allocate(future, schedule, tag)
+    } else {
+        RawTask::<F, R, S, T>::allocate(future, schedule, tag)
+    };
+
     let task = Task {
         raw_task,
         _marker: PhantomData,
@@ -152,12 +159,20 @@
         }
     }
 
+    // Wrap the future into one that which thread it's on.
     let future = Checked {
         id: thread_id(),
         inner: ManuallyDrop::new(future),
     };
 
-    let raw_task = RawTask::<_, R, S, T>::allocate(future, schedule, tag);
+    // Allocate large futures on the heap.
+    let raw_task = if mem::size_of::<F>() >= 2048 {
+        let future = alloc::boxed::Box::pin(future);
+        RawTask::<_, R, S, T>::allocate(future, schedule, tag)
+    } else {
+        RawTask::<_, R, S, T>::allocate(future, schedule, tag)
+    };
+
     let task = Task {
         raw_task,
         _marker: PhantomData,