Showing posts with label live objects. Show all posts
Showing posts with label live objects. Show all posts

Thursday, 17 December 2015

Find the total used objects and cursors in Dynamics AX 2012


static void Job1(Args _args)



{

Map result;

MapEnumerator enum;



str objectName, objectType;

boolean runningOnClient;

int aliveCount;

int totalObjects;

int totalCursors;

container _map;



;

[totalObjects, totalCursors, _map] = HeapDump::DumpAllObjects();

result = Map::create(_map);

enum = result.getEnumerator();



info(strfmt("Total Objects: %1", totalObjects));

info(strfmt("Total Cursors: %1", totalCursors));

while(enum.moveNext())



{

[objectName, runningOnClient, objectType] = enum.currentKey();

aliveCount = enum.currentValue();



info(strfmt("%1 %2 %3 %4", objectName, runningOnClient ? "Client" : "Server", objectType, aliveCount));



}

}