Skip to content

Close-MemoryMappedFile

SYNOPSIS

Closes and disposes an existing memory-mapped file by name.

SYNTAX

__AllParameterSets

Close-MemoryMappedFile [-Name] <string> [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

This function attempts to open an existing memory-mapped file with the specified name. If the file exists, it disposes of the file and frees the associated memory resources. If the file does not exist or has already been closed, a warning is displayed instead. This operation is useful for cleaning up unmanaged resources created with memory-mapped files.

EXAMPLES

EXAMPLE 1

Close-MemoryMappedFile -Name 'MySharedMemory'

Output:

VERBOSE: Memory-mapped file 'MySharedMemory' closed successfully.

Closes the memory-mapped file named 'MySharedMemory' and disposes of its resources.

PARAMETERS

-Name

The name of the memory-mapped file to close and dispose.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES