Share via


Invoke-NAVMemoryManager

Invokes the CLR memory manager (garbage collector) on the specified Business Central server instance.

Syntax

Default (Default)

Invoke-NAVMemoryManager
    [-ServerInstance] <String>
    [-Blocking]
    [-Generation <Int32>]
    [-CompactSmallObjectHeap]
    [-CompactLargeObjectHeap]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

You must specify a Business Central Server instance, which heap generations to collect, and whether or not to compact the small object and/or large object heaps. For more info on the garbage collector and relevant terminology, see https://go.microsoft.com/fwlink/?linkid=2119529

Examples

EXAMPLE 1

Invoke-NAVMemoryManager -ServerInstance BusinessCentral -Generation 2 -CompactSmallObjectHeap -CompactLargeObjectHeap

This example invokes the CLR garbage collector on the server instance BusinessCentral. It will be allowed to block server threads, collect objects in generations 0-2, and compact the small and large object heaps of generations 0-2.

EXAMPLE 2

Invoke-NAVMemoryManager -ServerInstance BusinessCentral -Generation 1 -Blocking

This example invokes the CLR garbage collector on the server instance BusinessCentral. It will collect objects in generations 0-1, compact neither the small nor large object heaps in generations 0-1, and will be allowed to block server threads.

EXAMPLE 3

Invoke-NAVMemoryManager -ServerInstance BusinessCentral

This example invokes the CLR garbage collector on the server instance BusinessCentral using the default parameters. It will collect objects in generations 0-2, without compacting heaps or blocking Business Central server threads.

Parameters

-Blocking

Specifies that garbage collection will be blocking ("non-concurrent"). The garbage collector will suspend execution on the server, making the server unresponsive during the garbage collection process. However, the garbage collector is usually fast and takes well under a second to complete. When you omit this parameter, garbage collection will be non-blocking (concurrent), which enables threads to continue during garbage collection. If the -CompactSmallObjectHeap parameter is used, this parameter is ignored.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-CompactLargeObjectHeap

Specifies that the garbage collector should compact the large object heap. If you omit this parameter, large object heap collection is sweep-only. This parameter is ignored unless the -Blocking or -CompactSmallObjectHeap parameters are used.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-CompactSmallObjectHeap

Specifies that the garbage collector should compact the small object heap. Garbage collection will be blocking even if the -Blocking parameter isn't used. If you omit the -CompactSmallObjectHeap parameter, the small object heap collection is sweep-only.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Generation

Specifies the number of the oldest generation to be collected. Valid options are 0, 1, or 2. For an in-depth description of heap generation: https://go.microsoft.com/fwlink/?linkid=2119529

Parameter properties

Type:Int32
Default value:2
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ServerInstance

Specifies the name of a Business Central Server instance, for example, BusinessCentral or myinstance. You can specify either the full name of an instance, such as BusinessCentralServer$myinstance or the short name, such as myinstance.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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

System.String

By value and property name: ServerInstance

System.Management.Automation.SwitchParameter

By property name: Blocking

System.Int32

By property name: Generation

System.Management.Automation.SwitchParameter

By property name: CompactSmallObjectHeap

System.Management.Automation.SwitchParameter

By property name: CompactLargeObjectHeap