< prev index next >

src/hotspot/share/memory/allocation.cpp

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "memory/arena.hpp"
  29 #include "memory/metaspaceShared.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "runtime/atomic.hpp"
  32 #include "runtime/os.hpp"
  33 #include "runtime/task.hpp"
  34 #include "runtime/threadCritical.hpp"
  35 #include "services/memTracker.hpp"
  36 #include "utilities/ostream.hpp"
  37 
  38 // allocate using malloc; will fail if no memory available
  39 char* AllocateHeap(size_t size,
  40                    MEMFLAGS flags,
  41                    const NativeCallStack& stack,
  42                    AllocFailType alloc_failmode /* = AllocFailStrategy::EXIT_OOM*/) {
  43   char* p = (char*) os::malloc(size, flags, stack);
  44   if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
  45     vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "AllocateHeap");
  46   }
  47   return p;
  48 }
  49 
  50 char* AllocateHeap(size_t size,
  51                    MEMFLAGS flags,




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "memory/arena.hpp"
  29 #include "memory/metaspaceShared.hpp"
  30 #include "memory/resourceArea.hpp"

  31 #include "runtime/os.hpp"
  32 #include "runtime/task.hpp"
  33 #include "runtime/threadCritical.hpp"
  34 #include "services/memTracker.hpp"
  35 #include "utilities/ostream.hpp"
  36 
  37 // allocate using malloc; will fail if no memory available
  38 char* AllocateHeap(size_t size,
  39                    MEMFLAGS flags,
  40                    const NativeCallStack& stack,
  41                    AllocFailType alloc_failmode /* = AllocFailStrategy::EXIT_OOM*/) {
  42   char* p = (char*) os::malloc(size, flags, stack);
  43   if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
  44     vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "AllocateHeap");
  45   }
  46   return p;
  47 }
  48 
  49 char* AllocateHeap(size_t size,
  50                    MEMFLAGS flags,


< prev index next >