Everyday findings in my world of .net and related stuff

Tag Archives: memory issues

Today I met a boundary when creeating a routine that produces a pricelist in AX 4.0 for a webshop. When creating the required xml I was receiving the error:

Error executing code: Insufficient memory to run script.

It turns out that AX4.0 per default has a 4mb buffersize. And as the resulting xml would contain about 16 mb of data I kept getting the exception. I found good help to increase the buffersize in this post from Martin Dráb.

This will create a memorydump in the same folder as where ProcDump is located.

As described in the article on msdn, it could be a good idea to create a baseline/initial dump and afterwards create another dump to see how memory consumption evolves.

Having created the dump file, we need to switch to Visual studio – in my case VS 2015 Enterprise

From the files menu select “open file” and browse to select your dump file. You will see something like this

If you do not see the “Debug Managed Memory” action, then your version of VS doesn’t support this and You will need to upgrade to a “bigger” version.

In my scenario it was quite obvious in which area the problem were to be found – please note the “Size (Bytes)” column.

Having the information above I could go back to my code at analyze where the objects were used and ensure proper release of the memory used by these objects. If you know what to look for, things get a hole lot easier:-)