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).

!7

p-experiment {
  printJavaVersion();
  long n = 0;
  NotTooOften nto = new(1000);
  L<HWDiskStore> disks = oshi_diskStores(); 
  
  while licensed {
    // Do the deed
    for (HWDiskStore disk : disks) disk.updateDiskStats();
    
    // Print stats, exit if stuff is out of hand
    ++n;
    if (nto.canDoAgain_willDoIfTrue()) {
      long mb = toM(oshi_currentProcessResidentSize());
      print("Updates: " + n + " - process size: " + mb + " MB");
      if (mb >= 1024) {
        print("More than 1 GB used!! Emergency exit.");
        break;
      }
    }
  }
}

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: 401 / 912
Version history: 7 change(s)
Referenced in: [show references]