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

17
LINES

< > BotCompany Repo | #1012109 // Measure size of fairLock (ReentrantLock) - 48 bytes in CompressedOOPS 64 Bit VM

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

Libraryless. Click here for Pure Java version (966L/7K/24K).

!7

static int n = 1000000;

p {
  O[] array = new O[n];
  long mem1 = usedMemoryAfterGC();
  
  for i over array:
    array[i] = fairLock();
    
  long mem2 = usedMemoryAfterGC();
  double objSize = (mem2-mem1)/(double) l(array);
  int rounded = iround(objSize);
  //long f = guessHashMapSize(tableSize);
  print("Approximate object size: " + objSize + " => " + rounded + " bytes");
}

Author comment

Began life as a copy of #1009433

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012109
Snippet name: Measure size of fairLock (ReentrantLock) - 48 bytes in CompressedOOPS 64 Bit VM
Eternal ID of this version: #1012109/7
Text MD5: 92dcc6a7917140ddc3a56b660724f9fe
Transpilation MD5: d56e7130285da63ed984586635324237
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-18 16:29:11
Source code size: 402 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 411 / 523
Version history: 6 change(s)
Referenced in: [show references]