src/share/vm/memory/heap.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6970683 Sdiff src/share/vm/memory

src/share/vm/memory/heap.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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  *


 123   void  release();                               // releases all allocated memory
 124   bool  expand_by(size_t size);                  // expands commited memory by size
 125   void  shrink_by(size_t size);                  // shrinks commited memory by size
 126   void  clear();                                 // clears all heap contents
 127 
 128   // Memory allocation
 129   void* allocate  (size_t size);                 // allocates a block of size or returns NULL
 130   void  deallocate(void* p);                     // deallocates a block
 131 
 132   // Attributes
 133   void*  begin() const                           { return _memory.low (); }
 134   void*  end() const                             { return _memory.high(); }
 135   bool   contains(void* p) const                 { return begin() <= p && p < end(); }
 136   void*  find_start(void* p) const;              // returns the block containing p or NULL
 137   size_t alignment_unit() const;                 // alignment of any block
 138   size_t alignment_offset() const;               // offset of first byte of any block, within the enclosing alignment unit
 139   static size_t header_size();                   // returns the header size for each heap block
 140 
 141   // Returns reserved area high and low addresses
 142   char *low_boundary() const                     { return _memory.low_boundary (); }

 143   char *high_boundary() const                    { return _memory.high_boundary(); }
 144 
 145   // Iteration
 146 
 147   // returns the first block or NULL
 148   void* first() const       { return next_free(first_block()); }
 149   // returns the next block given a block p or NULL
 150   void* next(void* p) const { return next_free(next_block(block_start(p))); }
 151 
 152   // Statistics
 153   size_t capacity() const;
 154   size_t max_capacity() const;
 155   size_t allocated_capacity() const;
 156   size_t unallocated_capacity() const            { return max_capacity() - allocated_capacity(); }
 157 
 158   // Debugging
 159   void verify();
 160   void print()  PRODUCT_RETURN;
 161 };
   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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  *


 123   void  release();                               // releases all allocated memory
 124   bool  expand_by(size_t size);                  // expands commited memory by size
 125   void  shrink_by(size_t size);                  // shrinks commited memory by size
 126   void  clear();                                 // clears all heap contents
 127 
 128   // Memory allocation
 129   void* allocate  (size_t size);                 // allocates a block of size or returns NULL
 130   void  deallocate(void* p);                     // deallocates a block
 131 
 132   // Attributes
 133   void*  begin() const                           { return _memory.low (); }
 134   void*  end() const                             { return _memory.high(); }
 135   bool   contains(void* p) const                 { return begin() <= p && p < end(); }
 136   void*  find_start(void* p) const;              // returns the block containing p or NULL
 137   size_t alignment_unit() const;                 // alignment of any block
 138   size_t alignment_offset() const;               // offset of first byte of any block, within the enclosing alignment unit
 139   static size_t header_size();                   // returns the header size for each heap block
 140 
 141   // Returns reserved area high and low addresses
 142   char *low_boundary() const                     { return _memory.low_boundary (); }
 143   char *high() const                             { return _memory.high(); }
 144   char *high_boundary() const                    { return _memory.high_boundary(); }
 145 
 146   // Iteration
 147 
 148   // returns the first block or NULL
 149   void* first() const       { return next_free(first_block()); }
 150   // returns the next block given a block p or NULL
 151   void* next(void* p) const { return next_free(next_block(block_start(p))); }
 152 
 153   // Statistics
 154   size_t capacity() const;
 155   size_t max_capacity() const;
 156   size_t allocated_capacity() const;
 157   size_t unallocated_capacity() const            { return max_capacity() - allocated_capacity(); }
 158 
 159   // Debugging
 160   void verify();
 161   void print()  PRODUCT_RETURN;
 162 };
src/share/vm/memory/heap.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File