Is there a way to find out the byte size of an object ?
Some equivalent to sizeof() ?
Thanks
Is there a way to find out the byte size of an object ?
Some equivalent to sizeof() ?
Thanks
only very few object types support sizeOf(). What is it you want to see? You can see some in the memory viewer in ths SDK.
Hi Jim,
I'm finding that my objects occupy a surprising amount of memory and I'm now running into memory issues for some models of watch so I'm hunting for savings. For example it looks like a Position.Location object occupies 136 bytes. I've been pretty lax about including objects like that in my own objects and didn't know how much impact they'd have. Without a sizeof() operation I'm looking for some way to understand the sizes of various objects. I'll look for the memory viewer.
Thanks
I'll look for the memory viewer.
It's in the simulator: File > View Memory. I assume you must have used this already since you know that a Location object takes 136 bytes, unless you're looking at System.Stats.usedMemory.
I'm now running into memory issues for some models of watch so I'm hunting for savings
Here's a couple of threads which may help:
https://forums.garmin.com/developer/connect-iq/f/discussion/6000/preserving-memory-in-monkey-c/39909
Unfortunately some of the methods for saving memory make your code harder to read and maintain.
I'm printing out free memory using Sys.getSystemStats().
I'll check out the memory viewer and see if I can learn something there.
Thanks
Thanks to both of you for pointing me at the memory viewer.
It's a great help.