source: git/Singular/mminit.cc @ 584f84d

spielwiese
Last change on this file since 584f84d was 512a2b, checked in by Olaf Bachmann <obachman@…>, 24 years ago
p_polys.h git-svn-id: file:///usr/local/Singular/svn/trunk@4606 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.0 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: mminit.cc,v 1.21 2000-09-18 09:19:17 obachman 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 ad macros
16// by omalloc
17#define OMALLOC_C
18#include "omalloc.h"
19
20extern "C"
21{
22#include <gmp.h>
23}
24
25static int mmIsInitialized=mmInit();
26
27extern "C"
28{
29  void omSingOutOfMemoryFunc()
30  {
31    fprintf(stderr, "\nerror: no more memory\n");
32    omPrintStats(stderr);
33    m2_end(14);
34    /* should never get here */
35    exit(1);
36  }
37}
38
39int mmInit( void )
40{
41  if(mmIsInitialized==0)
42  {
43    mp_set_memory_functions(malloc,reallocSize,freeSize);
44    om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
45#ifndef OM_NDEBUG
46    om_Opts.ErrorHook = dErrorBreak;
47#endif   
48    omInitInfo();
49#ifdef OM_SING_KEEP
50    om_Opts.Keep = OM_SING_KEEP;
51#endif
52  }
53  mmIsInitialized=1;
54  return 1;
55}
56
57
58 
59
60
61
Note: See TracBrowser for help on using the repository browser.