memoryManager.cpp revision 2938
0N/A * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A // Must do an acquire so as to force ordering of subsequent 0N/A // loads from anything _memory_mgr_obj points to or implies. 0N/A // It's ok for more than one thread to execute the code up to the locked region. 0N/A // Extra manager instances will just be gc'ed. 0N/A // Get lock before setting _memory_mgr_obj 0N/A // since another thread may have created the instance 0N/A // Check if another thread has created the management object. We reload 0N/A // _memory_mgr_obj here because some other thread may have initialized 0N/A // it while we were executing the code before the lock. 0N/A // The lock has done an acquire, so the load can't float above it, but 0N/A // we need to do a load_acquire as above. 0N/A // Get the address of the object we created via call_special. 0N/A // Use store barrier to make sure the memory accesses associated 0N/A // with creating the management object are visible before publishing 0N/A // its address. The unlock will publish the store to _memory_mgr_obj 0N/A // because it does a release first. 0N/A // initialize the arrays for memory usage 0N/A // tracking concurrent collections we need two objects: one to update, and one to 0N/A // hold the publicly available "last (completed) gc" information. 0N/A // _num_collections now increases in gc_end, to count completed collections 0N/A // Keep memory usage of all memory pools 0N/A// A collector MUST, even if it does not complete for some reason, 0N/A// make a TraceMemoryManagerStats object where countCollection is true, 0N/A// to ensure the current gc stat is placed in _last_gc_stat. 0N/A // keep the last gc statistics for all memory pools // Set last collection usage of the memory pools managed by this collector // Compare with GC usage threshold // alternately update two objects making one public when complete // reset the current stat for diagnosability purposes "Must have same array size");