source: git/Singular/mmprivate.h @ 65d1ba

spielwiese
Last change on this file since 65d1ba was 65d1ba, checked in by Hans Schönemann <hannes@…>, 25 years ago
*hannes: memory backtrack utilities git-svn-id: file:///usr/local/Singular/svn/trunk@2953 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.2 KB
Line 
1#ifndef MEMPRIVAT_H
2#define MEMPRIVAT_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: mmprivate.h,v 1.5 1999-03-18 16:30:53 Singular Exp $ */
7/*
8* ABSTRACT
9*/
10#include "structs.h"
11#include "mmheap.h"
12
13#define MAX_BLOCK_SIZE  (((SIZE_OF_HEAP_PAGE) / 16)*4)
14
15#define INDEX_ENTRY_T   char
16extern const INDEX_ENTRY_T mm_IndexTable[];
17extern const size_t mm_mcbSizes[];
18extern struct sip_memHeap mm_theList[];
19#define mmGetSize( index ) mm_mcbSizes[index]
20
21#ifndef GENERATE_INDEX_TABLE
22#define mmGetIndex(size)                                        \
23 (size <= MAX_BLOCK_SIZE ? mm_IndexTable[(size -1) >> 2] : -1)
24#else /* GENERATE_INDEX_TABLE */
25int mmGetIndex( size_t );
26#endif /* ! GENERATE_INDEX_TABLE */
27
28#if defined(MDEBUG) || defined(GENERATE_INDEX_TABLE)
29
30#define MM_NUMBER_OF_FRONT_PATTERNS   4
31typedef struct DBMCB
32{
33  void* _nnext;
34  struct DBMCB * next;
35  struct DBMCB * prev;
36  #ifdef MTRACK
37  unsigned long bt_stack[BT_STACKMAX];
38  #endif
39  char * fname;
40  size_t size;
41  int lineno;
42  int flags;
43  memHeap heap;
44  char front_pattern[MM_NUMBER_OF_FRONT_PATTERNS];
45  void* data;
46} DBMCB;
47
48typedef DBMCB * pDBMCB;
49
50#define DebugOffsetFront (sizeof(DBMCB) - sizeof(void*))
51#define DebugOffsetBack 4
52
53#define SizeFromRealSize( size ) (size - DebugOffsetFront - DebugOffsetBack)
54#define RealSizeFromSize( size ) (size + DebugOffsetFront + DebugOffsetBack)
55
56
57extern DBMCB mm_theDBused;
58extern DBMCB mm_theDBfree;
59
60extern void * mm_maxAddr;
61extern void * mm_minAddr;
62
63#define MM_FREEFLAG 4
64#define MM_USEDFLAG 8
65
66void mmPrintFL( const char* fname, const int lineno );
67void mmDBInitNewHeapPage(memHeap heap);
68int mmCheckDBMCB ( DBMCB * what, int size , int flags);
69void mmFillDBMCB(DBMCB* what, size_t size, memHeap heap,
70                 int flags, char* fname, int lineno);
71void mmDBSetHeapsOfBlocks(memHeap fromheap, memHeap toheap);
72void mmTakeOutDBMCB (DBMCB* what );
73void mmMoveDBMCB ( pDBMCB from, pDBMCB to, DBMCB * what );
74void mmMoveDBMCBInto ( pDBMCB to, pDBMCB what );
75
76#endif /* MDEBUG */
77
78extern int mm_bytesMalloc;
79#ifdef HAVE_SBRK
80extern unsigned long mm_SbrkInit;
81#endif
82
83void mmCheckPrint( void );
84
85#endif /* MEMPRIVATE_H */
86
Note: See TracBrowser for help on using the repository browser.