My handheld RFID data terminal project is getting rather big - up to the point that I am now running out of ROM space. I first noticed this while trying to deploy… It just gives a “hardware error” and reports the bytes used. This is pretty annoying because it doesn’t tell me how much I have available and where the problem is… You can only see memory utilisation when deployment is successful.
I crossed the line when I implemented SystemUpdate - which took 48k - which means my app needs to be 100kb or smaller to fit on a Panda II, which it no longer does.
After cutting a lot to get it to deploy, it now looks like this:
Total: (13196 RAM - 123444 ROM - 58116 METADATA)
AssemblyRef = 172 bytes ( 43 elements)
TypeRef = 1192 bytes ( 298 elements)
FieldRef = 80 bytes ( 20 elements)
MethodRef = 1792 bytes ( 448 elements)
TypeDef = 2904 bytes ( 363 elements)
FieldDef = 1184 bytes ( 585 elements)
MethodDef = 3832 bytes ( 1911 elements)
DebuggingInfo = 1940 bytes
Attributes = 48 bytes ( 6 elements)
TypeSpec = 32 bytes ( 8 elements)
Resources Files = 96 bytes ( 4 elements)
Resources = 312 bytes ( 39 elements)
Resources Data = 1184 bytes
Strings = 17494 bytes
Signatures = 7424 bytes
ByteCode = 44305 bytes
In my quest to shave off unwanted bytes, I developed an Excel spreadsheet and macro to parse the output from the Output window in Visual Studio and graph what’s going on for me. See attached image for an example. It is easy to see where the memory goes now:
Realiser 46836
GHI 4064
Microsoft 72544
Now I have some questions…
Is there a better way to profile the app to see what is using memory and how much?
Is there a way to hook into the debugger to get real stats and not rely on the debug output?
The numbers don’t add up… The total calculates correct for ROM, but is a few hundred bytes out for RAM in the Deploy output. I also throught the detail items (e.g. AssemblyRef, TypeRef etc.) counts up to METADATA but it doesn’t add up either. Can someone explain how the numbers are made up please?
When it failed to deploy, the Deploy window reported 103292 bytes. It finally worked when I shaved it down to 90208. This makes sense because of the 100k/48k split - but what I don’t understand is why it now reports 123444 ROM after deployment.
So, Device Deployment window now says: "Deploying assemblies for a total size of 90208 bytes"
and Debug window says “Total: (13196 RAM - 123444 ROM - 58116 METADATA)”
Any assistance is greatly appreciated.