Set-MemoryMappedFile¶
SYNOPSIS¶
Creates or returns an existing memory-mapped file by name.
SYNTAX¶
__AllParameterSets¶
Set-MemoryMappedFile [-Name] <string> [-Path] <string> [[-Size] <long>] [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Checks whether a memory-mapped file with the given name already exists. If it does, returns it. If not, creates a new memory-mapped file backed by the specified path and size. This function ensures idempotent access to shared memory regions through named mapping.
EXAMPLES¶
EXAMPLE 1¶
Set-MemoryMappedFile -Name 'MySharedMap' -Path 'C:\temp\shared.dat' -Size 2MB
Output:
Capacity : 2097152
Name : MySharedMap
SafeMemoryMappedFileHandle : Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle
Returns a new memory-mapped file named 'MySharedMap' backed by 'C:\temp\shared.dat' with a size of 2MB.
PARAMETERS¶
-Name¶
The unique name for the memory-mapped file.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Path¶
Path to the file backing the memory-mapped region.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Size¶
Size in bytes of the memory-mapped file. Defaults to 1MB if not specified.
Type: System.Int64
DefaultValue: 1048576
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
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¶
System.IO.MemoryMappedFiles.MemoryMappedFile¶
{{ Fill in the Description }}
NOTES¶
Represents the created or retrieved memory-mapped file object. Provides access to shared memory backed by a file with support for named access and reuse.