Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.40 KB | None | 0 0
  1. import core.memory;
  2.  
  3. void main()
  4. {
  5.     GC.disable();
  6.     doSomethingLatencySensitive();
  7.     GC.enable();
  8.  
  9.     // About to do lots of memory-hungry stuff
  10.     // so improve performance by reserving GC memory up front
  11.     GC.reserve(1024 * 1024 * 1024);
  12.     doSomethingMemoryHungry();
  13.     GC.minimize();
  14.  
  15.     message.sendToServer();
  16.     GC.collect(); // Might as well run GC while waiting
  17.     waitForResponseFromServer();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement