Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1018913 // Measure memory size of object array

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (7959L/45K).

1  
!7
2  
3  
sclass LenOnly {
4  
  int len;
5  
}
6  
7  
sclass LenPlusClass {
8  
  int len;
9  
  Class c;
10  
}
11  
12  
p {
13  
  print(+isCompressedOOPS());
14  
  int n = 8*oneMegabyte_int();
15  
  
16  
  for (int l = 0; l <= 8; l++) {
17  
    final int _l = l;
18  
    print("new O[" + l + "] => " + exclusive_measureSizeOfObject(n, -> new O[_l]));
19  
  }
20  
  print("LenOnly=" + exclusive_measureSizeOfObject(n, -> new LenOnly));
21  
  print("LenOnly/unsafe=" + unsafe_sizeOf(new LenOnly));
22  
  print("LenPlusClass=" + exclusive_measureSizeOfObject(n, -> new LenPlusClass));
23  
}

Author comment

Began life as a copy of #1017100

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018913
Snippet name: Measure memory size of object array
Eternal ID of this version: #1018913/12
Text MD5: 49e2f2ac99dca1d12b30f5d1cdea7c34
Transpilation MD5: f62a9c730e56afa38331f8037034f268
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-11 18:51:21
Source code size: 527 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 266 / 467
Version history: 11 change(s)
Referenced in: [show references]