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