File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -250,7 +250,12 @@ void TaskLocal::Storage::initializeLinkParent(AsyncTask* task,
250250TaskLocal::MarkerItem *TaskLocal::MarkerItem::create (AsyncTask *task,
251251 Item *next, Kind kind) {
252252 size_t amountToAllocate = sizeof (MarkerItem);
253- void *allocation = _swift_task_alloc_specific (task, amountToAllocate);
253+ void *allocation;
254+
255+ // If we have a task, allocate from that task. If not, use malloc. This must
256+ // mirror the corresponding dealloc/free call in Item::destroy.
257+ if (task) allocation = _swift_task_alloc_specific (task, amountToAllocate);
258+ else allocation = malloc (amountToAllocate);
254259 return new (allocation) MarkerItem (next, kind);
255260}
256261
You can’t perform that action at this time.
0 commit comments