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

16
LINES

< > BotCompany Repo | #1005962 // gc - trigger Java's garbage collector & clean weak maps

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2139L/14K).

static volatile long gc_memoryUsedAfterGC;
static volatile long gc_lastStart;
static volatile long gc_duration;
static Lock gc_lock = lock();

static void gc() {
  callOpt(javax(), 'cleanWeakMaps);
  {
    lock gc_lock;
    gc_lastStart = sysNow();
    System.gc();
    gc_duration = sysNow()-gc_lastStart;
    gc_memoryUsedAfterGC = usedMemory();
  }
  vmBus_send('gcDone);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005962
Snippet name: gc - trigger Java's garbage collector & clean weak maps
Eternal ID of this version: #1005962/7
Text MD5: eb7c38b1558c34347c3dd0d926fdba5c
Transpilation MD5: 6c55d4523c48b0fc1143f0533c42f82a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-13 11:25:35
Source code size: 391 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 671 / 776
Version history: 6 change(s)
Referenced in: [show references]