How do I get the amount of physical memory, consumed by the DataSource (specifically — ByteArrayDataSource)? I use javax.mail.util.ByteArrayDataSource (byte[] bytes, String type) constructor, where I get bytes like this:
String str = "test";
byte[] bytes = str.getBytes();
Would that be str.length() in bytes? Any other ideas?