SHOWSORTMEM

Display memory usage during sort

WSupported on Windows
USupported on Unix

 

NSupported in Synergy .NET

The SHOWSORTMEM environment variable displays the memory that’s used during a sort operation.

Any value.

Memory used during sort operations is displayed.

Unless running as a console application, when using Synergy .NET, you must also set the SHOWSORTMEM_FILE environment variable to specify a log file.

The environment or synrc for xfServer.

Runtime, xfServer, isutl, fconvert

On Windows,

set SHOWSORTMEM=1
set SHOWSORTMEM_FILE=c:\temp\sort.log

On Unix,

SHOWSORTMEM=1                           ;export SHOWSORTMEM
SHOWSORTMEM_FILE=/usr3/temp/sort.log    ;export SHOWSORTMEM_FILE

The logged content may look something like this:

[DATWIN:MSTFIL]
Total phase 1 consumed 8520688 (8520688/0)
- tree nodes allocated (pass=1): 8192
Total phase 2 runs: 306
Total phase 2 consumed 20644992 (20644992/0)
- tree nodes allocated (pass=2): 306
Sort complete 55 seconds
[DATUNX:MSTFIL]
Total phase 1 consumed 4193344 (4194304/960)
- tree nodes allocated (pass=1): 3899
Total phase 2 runs: 643
Total phase 2 consumed 4134168 (4194304/60136)
- tree nodes allocated (pass=2): 58
- tree nodes allocated (pass=3): 58
- tree nodes allocated (pass=4): 58
- tree nodes allocated (pass=5): 58
- tree nodes allocated (pass=6): 58
- tree nodes allocated (pass=7): 58
- tree nodes allocated (pass=8): 58
- tree nodes allocated (pass=9): 58
- tree nodes allocated (pass=10): 58
- tree nodes allocated (pass=11): 58
- tree nodes allocated (pass=12): 58
- tree nodes allocated (pass=13): 16
Sort complete 114 seconds

The first file sorted, DATUNX:MSTFIL, consumed 8 MB during sort phase 1 to make use of all 8192 tree nodes, then grabbed 20 MB during phase 2. This file was sorted on a Windows platform that has a default upper memory ceiling of 64 MB, so the number of sort passes was held to a minimum, resulting in the best overall performance.

The second file sorted, DATUNX:MSTFIL, consumed 4 MB during phase 1 but was only able to acquire 3899 out of the 8192 tree nodes. During phase 2, the sort was limited to 4 MB and required 12 passes to complete.

This file (which happens to be identical to the first file) was sorted on a Unix platform, which has a smaller default upper memory ceiling of 4 MB and therefore caused the additional passes to occur. Setting SORTMEMMAX higher in this case would reduce the number of passes and improve performance. However, before setting SORTMEMMAX in a multi-user environment, consider how many processes may be running concurrent sorts so you don’t exhaust system memory.

Most sorts won’t require all 8192 tree nodes and, depending on how many sorted runs are generated, may only take a few phase 2 passes, and a minimum amount of memory will be used.