After you Enable the AVM for memory profiling, you can programmatically take snapshots. The benefit to taking snapshots programmatically is that you can assign your own tags to your snapshots, making it easy to associate the data in the snapshot with places in your application code.

The tag can be any string, however OpenEdge reserves tags beginning with the underscore character (_). If you supply a tag beginning with an underscore, the AVM issues an error message and no snapshot recording is generated.

The following code shows how to take memory snapshots programmatically.

USING Progress.Profiler.MemoryProfiler.
VAR HANDLE h.

MemoryProfiler:TakeSnapshot("pre").

RUN persproc.p PERSISTENT SET h.
MemoryProfiler:TakeSnapshot("post").

DELETE PROCEDURE h.
MemoryProfiler:TakeSnapshot("done").

In this example, an ABL procedure object named persproc.p was created between snapshots tagged with "pre" and "post". The ABL procedure object was deleted between snapshots tagged with "post" and "done". The snapshots are written to a Memory profile recording.