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

12
LINES

< > BotCompany Repo | #1032627 // Measure memory size of small object (1 pointer field) - should be 16, not 24?

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

Libraryless. Click here for Pure Java version (4194L/24K/82K).

!7

sclass Small {
  O pointer;
}

static int instances = oneMegabyte_int();

p {
  print("Size for 1-pointer-object: " + exclusive_measureSizeOfObject(instances, () -> new Small));
  print("JavaX guessed: " + unsafe_sizeOf(new Small));
}

Author comment

Began life as a copy of #1018913

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032627
Snippet name: Measure memory size of small object (1 pointer field) - should be 16, not 24?
Eternal ID of this version: #1032627/5
Text MD5: f01406ed7e6b049b528e8942cffa7178
Transpilation MD5: 39ae240b75dd556736c95560cf742dfb
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-29 21:12:31
Source code size: 249 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 80 / 124
Version history: 4 change(s)
Referenced in: [show references]