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

24
LINES

< > BotCompany Repo | #1016414 // OSHI updateDiskStats memory leak demo

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

Download Jar. Uses 5404K of libraries. Click here for Pure Java version (6720L/48K).

1  
!7
2  
3  
p-experiment {
4  
  printJavaVersion();
5  
  long n = 0;
6  
  NotTooOften nto = new(1000);
7  
  L<HWDiskStore> disks = oshi_diskStores(); 
8  
  
9  
  while licensed {
10  
    // Do the deed
11  
    for (HWDiskStore disk : disks) disk.updateDiskStats();
12  
    
13  
    // Print stats, exit if stuff is out of hand
14  
    ++n;
15  
    if (nto.canDoAgain_willDoIfTrue()) {
16  
      long mb = toM(oshi_currentProcessResidentSize());
17  
      print("Updates: " + n + " - process size: " + mb + " MB");
18  
      if (mb >= 1024) {
19  
        print("More than 1 GB used!! Emergency exit.");
20  
        break;
21  
      }
22  
    }
23  
  }
24  
}

Author comment

Began life as a copy of #1016411

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016414
Snippet name: OSHI updateDiskStats memory leak demo
Eternal ID of this version: #1016414/8
Text MD5: d244a57172b1be1ad97e52bdb400037b
Transpilation MD5: 4cf080fdc84edd59aac332cbc91f0cdb
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-17 14:53:30
Source code size: 593 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 412 / 932
Version history: 7 change(s)
Referenced in: [show references]