Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Operates with Q memory
- void FantasyMethod() {
- var o = new BigObject();
- {
- var temp = new BigObject();
- Populate(temp); // Populates o1 with N megabytes of data
- o = PerformSomeOperationsOn(temp); // Returns a BigObject of size M (M is close to N)
- // Currently, M+N memory is occupied, we have Q-M-N free
- }
- // Let's tell the garbage collector to catch up
- GC.Collect();
- GC.WaitForPendingFinalizers();
- // Currently, M memory is occupied
- DoUsefulStuffWith(o); // This method can only work if at least Q-M-N/2 memory is free
- }
- using (var b = new DisposableObject())
- {
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement