Is there a way to measure the total size of a datagram?

I’m looking at building a custom version of the distributedNode code for the game I’m working on, but for debugging purposes I was hoping there would be a way to see how large a given datagram is.

Any ideas on how to do this? Or more specifically, how to measure how much memory a variable/object in general uses?

The reason I’m asking is I want to keep an eye on how big a datagram gets if I start blasted it out, because I’m worried some of them might get a bit larger. (i.e. if the data I’m sending out consumes 1MB of memory I’ve got a big problem).

Have you seen Datagram.getLength() in the API reference?

But there’s not a general way to ask how much memory any object consumes. That’s impossible because each object could store its information in a different way (and not all of it is stored within the object itself).

David

Cool, that’s exactly what I was looking for. Thanks David :slight_smile: (seems like you are always finding the obvious answers to my questions lol)