@@ -318,7 +318,9 @@ public struct ExecutorJob: Sendable, ~Copyable {
318318 }
319319
320320 /// Execute a closure, passing it the bounds of the executor private data
321- /// for the job.
321+ /// for the job. The executor is responsible for ensuring that any resources
322+ /// referenced from the private data area are cleared up prior to running the
323+ /// job.
322324 ///
323325 /// Parameters:
324326 ///
@@ -510,9 +512,8 @@ extension ExecutorJob {
510512 /// A job-local stack-disciplined allocator.
511513 ///
512514 /// This can be used to allocate additional data required by an
513- /// executor implementation; memory allocated in this manner will
514- /// be released automatically when the job is disposed of by the
515- /// runtime.
515+ /// executor implementation; memory allocated in this manner must
516+ /// be released by the executor before the job is executed.
516517 ///
517518 /// N.B. Because this allocator is stack disciplined, explicitly
518519 /// deallocating memory out-of-order will cause your program to abort.
@@ -540,23 +541,20 @@ extension ExecutorJob {
540541 return unsafe UnsafeMutableBufferPointer< T > ( start: typedBase, count: capacity)
541542 }
542543
543- /// Deallocate previously allocated memory. Note that the task
544- /// allocator is stack disciplined, so if you deallocate a block of
545- /// memory, all memory allocated after that block is also deallocated.
544+ /// Deallocate previously allocated memory. You must do this in
545+ /// reverse order of allocations, prior to running the job.
546546 public func deallocate( _ buffer: UnsafeMutableRawBufferPointer ) {
547547 unsafe _jobDeallocate( context, buffer. baseAddress!)
548548 }
549549
550- /// Deallocate previously allocated memory. Note that the task
551- /// allocator is stack disciplined, so if you deallocate a block of
552- /// memory, all memory allocated after that block is also deallocated.
550+ /// Deallocate previously allocated memory. You must do this in
551+ /// reverse order of allocations, prior to running the job.
553552 public func deallocate< T> ( _ pointer: UnsafeMutablePointer < T > ) {
554553 unsafe _jobDeallocate( context, UnsafeMutableRawPointer ( pointer) )
555554 }
556555
557- /// Deallocate previously allocated memory. Note that the task
558- /// allocator is stack disciplined, so if you deallocate a block of
559- /// memory, all memory allocated after that block is also deallocated.
556+ /// Deallocate previously allocated memory. You must do this in
557+ /// reverse order of allocations, prior to running the job.
560558 public func deallocate< T> ( _ buffer: UnsafeMutableBufferPointer < T > ) {
561559 unsafe _jobDeallocate( context, UnsafeMutableRawPointer ( buffer. baseAddress!) )
562560 }
0 commit comments