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

fieker-DuValspielwiese
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
RevLine 
[0e1846]1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
[512a2b]4/* $Id: mminit.cc,v 1.21 2000-09-18 09:19:17 obachman Exp $ */
[0e1846]5/*
[e2f1c7]6* ABSTRACT: init of memory management
[0e1846]7*/
8
[c232af]9#include <stdio.h>
[0e1846]10#include <stdlib.h>
[c232af]11
[0e1846]12#include "mod2.h"
[c232af]13#include "mmalloc.h"
[512a2b]14#include "structs.h"
[c232af]15// this prevents the definition of malloc/free ad macros
16// by omalloc
17#define OMALLOC_C
[512a2b]18#include "omalloc.h"
[0e1846]19
[c232af]20extern "C"
[0e1846]21{
[c232af]22#include <gmp.h>
[0e1846]23}
24
[c232af]25static int mmIsInitialized=mmInit();
[0e1846]26
[c232af]27extern "C"
[0e1846]28{
[c232af]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  }
[0e1846]37}
38
39int mmInit( void )
40{
[f3d535]41  if(mmIsInitialized==0)
42  {
[c232af]43    mp_set_memory_functions(malloc,reallocSize,freeSize);
44    om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
[512a2b]45#ifndef OM_NDEBUG
46    om_Opts.ErrorHook = dErrorBreak;
47#endif   
[c232af]48    omInitInfo();
49#ifdef OM_SING_KEEP
50    om_Opts.Keep = OM_SING_KEEP;
[0e1846]51#endif
[f3d535]52  }
[8fc4bee]53  mmIsInitialized=1;
[0e1846]54  return 1;
55}
[c232af]56
57
58 
59
60
61
Note: See TracBrowser for help on using the repository browser.