source: git/kernel/mminit.cc @ d3e630

spielwiese
Last change on this file since d3e630 was d3e630, checked in by Hans Schönemann <hannes@…>, 14 years ago
*hannes: code cleanup (see ChangeLog) git-svn-id: file:///usr/local/Singular/svn/trunk@12029 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 971 bytes
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: mminit.cc,v 1.5 2009-07-28 14:15:05 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    om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
41#ifndef OM_NDEBUG
42    om_Opts.ErrorHook = dErrorBreak;
43#endif
44    omInitInfo();
45#ifdef OM_SING_KEEP
46    om_Opts.Keep = OM_SING_KEEP;
47#endif
48  }
49  mmIsInitialized=1;
50  return 1;
51}
Note: See TracBrowser for help on using the repository browser.