source: git/kernel/mminit.cc @ 6b9532

spielwiese
Last change on this file since 6b9532 was 35aab3, checked in by Hans Schönemann <hannes@…>, 20 years ago
This commit was generated by cvs2svn to compensate for changes in r6879, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6880 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: mminit.cc,v 1.1.1.1 2003-10-06 12:15:57 Singular Exp $ */
5/*
6* ABSTRACT: init of memory management
7*/
8
9#include <stdio.h>
10#include <stdlib.h>
11
12#include "mod2.h"
13#include "mmalloc.h"
14#include "structs.h"
15// this prevents the definition of malloc/free and macros
16// by omalloc
17#define OMALLOC_C
18#include "omalloc.h"
19
20#include <si_gmp.h>
21
22int mmIsInitialized=mmInit();
23
24extern "C"
25{
26  void omSingOutOfMemoryFunc()
27  {
28    fprintf(stderr, "\nerror: no more memory\n");
29    omPrintStats(stderr);
30    m2_end(14);
31    /* should never get here */
32    exit(1);
33  }
34}
35
36int mmInit( void )
37{
38  if(mmIsInitialized==0)
39  {
40#if defined(OMALLOC_USES_MALLOC) || defined(X_OMALLOC)
41    mp_set_memory_functions(omMallocFunc,omReallocSizeFunc,omFreeSizeFunc);
42#else
43    mp_set_memory_functions(malloc,reallocSize,freeSize);
44#endif
45    om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
46#ifndef OM_NDEBUG
47    om_Opts.ErrorHook = dErrorBreak;
48#endif
49    omInitInfo();
50#ifdef OM_SING_KEEP
51    om_Opts.Keep = OM_SING_KEEP;
52#endif
53  }
54  mmIsInitialized=1;
55  return 1;
56}
Note: See TracBrowser for help on using the repository browser.