Invoke-NAVMemoryManager

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

Syntax

Invoke-NAVMemoryManager
      [-ServerInstance] <String>
      [-Blocking]
      [-Generation <Int32>]
      [-CompactSmallObjectHeap]
      [-CompactLargeObjectHeap]
      [-Force]
      [-ProgressAction <ActionPreference>]
      [-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.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters: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

Type:Int32
Position:Named
Default value:2
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ProgressAction

A common PowerShell parameter that determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider. Learn more.

Type:ActionPreference
Aliases:proga
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

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