/// <summary> /// Request to free memory allocated by the worker (for output bindings) /// </summary> /// <param name="outputMaps">List of names of shared memory maps to close from the worker.</param> internal void SendCloseSharedMemoryResourcesForInvocationRequest(IList <string> outputMaps) { CloseSharedMemoryResourcesRequest closeSharedMemoryResourcesRequest = new CloseSharedMemoryResourcesRequest(); closeSharedMemoryResourcesRequest.MapNames.AddRange(outputMaps); SendStreamingMessage(new StreamingMessage() { CloseSharedMemoryResourcesRequest = closeSharedMemoryResourcesRequest }); }
/// <summary> /// Request to free memory allocated by the worker (for output bindings) /// </summary> /// <param name="outputMaps">List of names of shared memory maps to close from the worker.</param> internal void SendCloseSharedMemoryResourcesForInvocationRequest(IList <string> outputMaps) { // Request the worker to drop its references to any shared memory maps that it had produced. // This is because the host has read them (or holds a reference to them if caching is enabled.) // The worker will not delete the resources allocated for the memory maps; it will only drop its reference // so that the worker process does not prevent the OS from freeing the memory maps when the host attempts // to free them (either right away after reading them or if caching is enabled, then when the cache decides // to evict that object based on its eviction policy). CloseSharedMemoryResourcesRequest closeSharedMemoryResourcesRequest = new CloseSharedMemoryResourcesRequest(); closeSharedMemoryResourcesRequest.MapNames.AddRange(outputMaps); SendStreamingMessage(new StreamingMessage() { CloseSharedMemoryResourcesRequest = closeSharedMemoryResourcesRequest }); }