/* src/mm/memory.c -
- Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
- R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
- C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
- Institut f. Computersprachen - TU Wien
+ Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+ E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+ J. Wenninger, Institut f. Computersprachen - TU Wien
This file is part of CACAO.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
- Contact: cacao@complang.tuwien.ac.at
+ Contact: cacao@cacaojvm.org
Authors: Reinhard Grafl
Changes: Christian Thalinger
- $Id: memory.c 3516 2005-10-28 11:37:03Z twisti $
+ $Id: memory.c 4357 2006-01-22 23:33:38Z twisti $
*/
#define DEFAULT_CODEMEM_SIZE 128 * 1024 /* defaulting to 128kB */
+#if defined(USE_THREADS)
static java_objectheader *codememlock = NULL;
+#endif
static int codememsize = 0;
static void *codememptr = NULL;
void *p = calloc(size, 1);
if (!p)
- throw_cacao_exception_exit(string_java_lang_InternalError,
- "Out of memory");
+ exceptions_throw_outofmemory_exit();
return p;
}
if ((p = memory_checked_alloc(codememsize + pagesize - 1)) == NULL)
return NULL;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
if (opt_stat) {
codememusage += codememsize + pagesize - 1;
if (size == 0)
return NULL;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
if (opt_stat) {
memoryusage += size;
}
}
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
if (opt_stat)
memoryusage = (memoryusage - len1) + len2;
#endif
dst = realloc(src, len2);
if (!dst)
- throw_cacao_exception_exit(string_java_lang_InternalError,
- "Out of memory");
+ exceptions_throw_outofmemory_exit();
return dst;
}
assert(0);
}
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
if (opt_stat)
memoryusage -= size;
#endif
di->allocateddumpsize += newdumpblocksize;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
/* the amount of globally allocated dump memory (thread save) */
if (opt_stat)
di->useddumpsize += size;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
if (opt_stat)
if (di->useddumpsize > maxdumpsize)
maxdumpsize = di->useddumpsize;
di->allocateddumpsize -= tmp->size;
di->currentdumpblock = tmp->prev;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
/* the amount of globally allocated dump memory (thread save) */
if (opt_stat)