Table of Contents

Memory Planning

A simulation that runs out of memory does not slow down and finish; it stops, and it stops late. In a measured run with memory capped just under what it needed, the run aborted between 75% and 96% of the way through the program, after nearly all of its time had been spent. Estimate the memory before building the project, from two things that are in hand before anything is set up — the NC program and the workpiece — and then choose the resolution against the machine that will run it.

Where the Memory Goes

A run holds three things:

Part What it is Set by Changes with the mesh width?
Baseline the runtime, the machine and tool models, the project itself the project no — about 1 GB, plus the imported workpiece files below
Step results the positions, physics results and display data kept for every step; playback, charts and step picking read them the number of steps, which the NC program sets no
Workpiece mesh the cubes along the workpiece's surface the workpiece's surface and the mesh width yes

The first two are the project's minimum memory cost: no resolution setting takes them away. The third is what the resolution chooses, and which side is the larger decides what the resolution is worth. The NC program sizes the one, the workpiece the other:

  • A workpiece with a large, complex surface and a short program is ruled by the mesh, and the resolution is the deciding setting. A wheel-shaped part is the usual case: much surface, and few programs compared with a part of the same size carved out of a block. A 586 mm freeform shell played with a 4.8 KB program peaked at 3.6 GB, nearly all of it mesh, and the stock's mesh alone goes from 3.2 GB at 0.25 mm to 17.6 GB at 0.0625 mm: one or two rungs decide whether the run fits at all.
  • A long program on a small workpiece is ruled by the step results, and the resolution barely moves the peak. On a Ø65 × 50 mm blank, 2.7 million steps peaked at 14.3 GB, of which the mesh at 1 mm was under 0.1 GB.

So estimate both sides before choosing. The question is how much of the machine is left for the mesh once the minimum is paid — and on a workpiece with a large, complex surface that is nearly the whole question.

The NC Program: Steps

Plan for about 5 KB per step. A step keeps about 2.9 KB of results; the rest is the working room the runtime takes around them. Over whole runs dominated by step results, the peak came to 4.1–5.3 KB per step with everything included, the lower figure on the largest run (15.7 million steps).

The number of steps follows the spindle, not the file. By default a step is taken every spindle revolution while the spindle turns (Machining Motion Resolution), and every millimetre of travel while it is stopped. The best estimate is therefore the machining time multiplied by the spindle speed: a program that cuts for two hours at 8,000 rpm is about a million steps, about 5 GB. Where the CAM system or the post-processor writes a machining time into the program, that is the number to use.

The file size alone gives a rougher figure, but it is available at a glance. On the programs measured, one megabyte of program was 80,000 to one million steps — roughly 0.4 to 5 GB of step results. Where a program sits in that range depends on how long its moves are: a finishing program of many short blocks turns the spindle a few times per block, a roughing program of long moves many times.

Program Size Steps Steps per byte
Turbine part, three programs 46.3 MB 3.96 million 0.08
Demo airplane, all 34 programs 14.45 MB 2.70 million 0.18
Demo airplane, second program 0.57 MB 221,000 0.39
Large part, one program 33.2 MB 15.7 million 0.45
Demo airplane, first program 0.41 MB 199,000 0.49
Wheel-shaped shell, roughing 0.6 MB 300,000 0.5
Same shell, a short roughing excerpt 4.8 KB 4,800 1.0

The Workpiece: the Mesh

The mesh is built along the workpiece's surface, not through its volume, so its memory goes with the surface area, and each halving of the width can multiply it by four or more. Two surfaces count: the stock's own, built at the workpiece's Initial Resolution, and every surface the program cuts, built at the Machining Resolution.

How much the stock's own surface costs depends on how complex the initial geometry is. A cube stops dividing where the surface inside it is flat, so a simple stock — a box or a cylinder — costs almost nothing at any width: it belongs to the minimum, and it leaves the machine's room to the surfaces the program cuts, which is what lets the width go finer. A complex stock — an imported freeform solid such as a wheel or a shell — costs memory before the first cut, and at a fine width it takes the large part of the run's memory; there the Initial Resolution is as much a memory decision as the Machining Resolution.

An imported workpiece also costs memory as a file, before any mesh is built. An STL is held at about twice its binary file size, and the workpiece's STL files — the stock and the design part — are held twice over, once for editing and once for the run, so budget about four times their size on disk. That is negligible for a file of a few megabytes and not for one of several hundred: a 550 MB stock STL holds about 2 GB for as long as the project is open.

Measured:

Stock Width Mesh memory
Cylinder Ø65 × 50 mm, one roughing program 2 / 1 / 0.5 / 0.25 / 0.125 mm 0.03 / 0.05 / 0.08 / 0.19 / 0.82 GB
Same cylinder, roughing and finishing programs 0.0625 mm 6.4 GB
Freeform shell 586 × 586 × 92 mm, imported stock, before any cut 0.25 / 0.125 / 0.0625 mm 3.2 / 7.1 / 17.6 GB
Stock 600 × 450 × 240 mm, after the whole program 0.125 mm about 9 GB

Two things to read from it. The increments stay small while the width is coarser than the part's own detail, and then grow fast: the cylinder's mesh quadrupled from 0.25 to 0.125 mm. And the stock's size moves the whole curve: the shell needs gigabytes at widths where the small cylinder is still under 200 MB.

For a stock unlike any of these, measure one point and scale from it. The stock is meshed when a run first needs it, not when the project opens, so play the program's first few blocks at a coarse rung, read the peak memory (see the end of this page), take the baseline off, and multiply what is left by four for each halving of the width — more once the width is finer than the part's features.

Measured Runs

Whole runs, peak memory of the process, for finding a comparable case:

Stock Width Program Steps Peak Mostly
Cylinder Ø65 × 50 mm 1 mm 0.41 MB 199,000 2.4 GB baseline and step results
Same 1 mm 14.45 MB 2.70 million 14.3 GB step results
Same 0.0625 mm 0.98 MB 421,000 9.3 GB mesh
Turbine part 1 mm 46.3 MB 3.96 million 18.2 GB step results
Freeform shell 586 × 586 × 92 mm 0.25 mm 4.8 KB 4,800 3.6 GB mesh
Stock 600 × 450 × 240 mm 0.125 mm 33.2 MB 15.7 million 64.9 GB step results

Widths Used in Practice

Machining Resolutions in real use run from 2 mm to 0.03125 mm — seven rungs, a factor of 64 in width — and the scenario picks the rung:

Scenario What rules the memory Machining Resolution
Very large workpiece, massive program, quick overview both, and the step results cannot be lowered 2 mm
Large, complex surface and few programs — a wheel, for example the mesh the rung the machine's room allows; it decides whether the run fits
Simple stock — a box or a cylinder — and a moderate program the step results; the stock costs almost nothing finer is affordable, since only the cut surfaces grow
Delicate fine cut on a shell the mesh, where the fine cut is down to 0.03125 mm, to estimate the behaviour of the cut; finer than the thinnest wall it touches

The two ends show the rule at work. With a massive program on a very large workpiece, the step results already take most of the machine and no width lowers them, so the coarsest rung keeps the mesh out of the way and the overview fast. With a delicate cut on a shell, the question is how a thin wall behaves, which a width coarser than the wall cannot answer at all, so the width goes as fine as the cut requires — and the estimate below says whether the machine can carry it, or whether only that cut should be played at that width.

Fitting It to the Machine

Add the parts up:

peak ≈ 1 GB + 4 × workpiece STL size + steps × 5 KB + mesh

and compare the sum with the memory the machine can give the run: its physical memory, less what the operating system and the other programs hold, less any other simulation running on the same machine at the same time.

There is little slack on either side of that comparison. The estimate is a peak on a machine with memory to spare, where the runtime takes more working room than it strictly needs; measured, a run still completed with about 15% less than its unconstrained peak, and failed below that. An estimate that does not fit therefore does not fit, and the run that tries it ends in an out-of-memory abort near the end rather than at the start.

Then choose, in this order:

  1. The part the width cannot move. If the baseline and the step results alone do not fit, no width will rescue the run, because that memory is not in the mesh. Reduce the steps instead: ScaledFeedPerCycle(2) takes a step every two revolutions and halves the step results, at the cost of sparser force samples; or run the program stage by stage with a Record Meshed Geometry entry after each stage, so that a run holds only the steps of the stages it plays (A Mission That Resumes); or run it on a machine with more memory.
  2. Then the width — on a large, complex surface, the decision itself. What remains after the minimum is the room for the mesh, and each rung coarser cuts the mesh to between a quarter and a half. Both widths count: the Initial Resolution for the stock's own surface, the Machining Resolution for every surface the program cuts. Take the coarsest rung of the ladder that does the job, which is the least memory the job can cost, and check that its mesh fits in the room. A setup check, a collision check or a first look at the forces runs at 1 mm or coarser; a wall, web or floor thinner than the width needs a width finer than its thickness (Mesh Resolution). The finest rung the room allows is a ceiling, not a target.
  3. Fine widths only where they are needed. Rough at a coarse width, record the result, and cut only the finishing program fine. Measured on the demo airplane, that used 46% less memory and 53% less time than playing both programs at 0.0625 mm (Resuming, then cutting finer).

Before committing the machine to the whole program, check the estimate on a trimmed excerpt at the chosen width: play it, read the process's peak memory (on Windows, the Peak working set column of Task Manager's Details tab), and compare it with the estimate for the same excerpt. The step results scale with the step count; the mesh grows with how much surface the whole program cuts, so the excerpt's figure is a lower bound on that part.

See Also