Libraryless. Click here for Pure Java version (966L/7K/24K).
1 | !7 |
2 | |
3 | static int n = 1000000; |
4 | |
5 | p {
|
6 | O[] array = new O[n]; |
7 | long mem1 = usedMemoryAfterGC(); |
8 | |
9 | for i over array: |
10 | array[i] = fairLock(); |
11 | |
12 | long mem2 = usedMemoryAfterGC(); |
13 | double objSize = (mem2-mem1)/(double) l(array); |
14 | int rounded = iround(objSize); |
15 | //long f = guessHashMapSize(tableSize); |
16 | print("Approximate object size: " + objSize + " => " + rounded + " bytes");
|
17 | } |
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: | 681 / 843 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |