15
15
16
16
/* debugging flags & variables */
17
17
/*!
18
- * \var db
18
+ * \var long db
19
19
* \brief bytes held by vstring instances outside of the stack of temporaries
20
20
*
21
21
* monitors the number of bytes (including the terminal NUL) currently used in
31
31
/*E*/ extern long db ;
32
32
/*E*/ extern long db0 ;
33
33
/*!
34
- * \var db1
34
+ * \var long db1
35
35
* \brief bytes held by vstring instances inside of the stack of temporaries
36
36
*
37
37
* monitors the number of bytes currently pointed to by \ref vstring pointers
43
43
* \bug Seems never be displayed.
44
44
*/
45
45
/*E*/ extern long db1 ;
46
+ /*!
47
+ * \var long db2
48
+ * Bytes held in \ref blocks managed in \ref tempAllocStack
49
+ * "temporary pointer stacks".
50
+ */
46
51
/*E*/ extern long db2 ;
47
52
/*!
48
53
* \var db3
@@ -315,27 +320,27 @@ void *poolFixedMalloc(long size /* bytes */);
315
320
* \ref memFreePool. If this block exists, but has not sufficient size, it is
316
321
* reallocated from the system. If the pool is empty, a new \ref block of
317
322
* the given size is allocated from the system. In any case, the header of the
318
- * \ref block is properly initialized.
323
+ * \ref block is properly initialized. Exits program on out of memory
324
+ * condition.
319
325
* \param[in] size (in bytes) of the block, not including the block header.
320
326
* \return a free and initialized block of memory with at least the requested
321
- * user space.
322
- * \bug uses outOfMemory that can stack up endlessly
327
+ * user space. Exit on out-of-memory
323
328
*/
324
329
void * poolMalloc (long size /* bytes */ );
325
330
/*!
326
331
* \fn poolFree(void *ptr)
327
332
*
328
333
* Removes \p ptr from the \ref memUsedPool, if it is listed there. Then tries
329
334
* adding it to the \ref memFreePool. If this pool is full, it is increased by
330
- * \ref MEM_POOL_GROW. If this fails, an error is created , else \p ptr is
335
+ * \ref MEM_POOL_GROW. If this fails, the program is exited , else \p ptr is
331
336
* added.
332
337
* \param[in] ptr pointer to a \ref block.
333
338
* \pre
334
339
* all memory pointed to by \p ptr is considered free. This holds even if it
335
340
* it is kept in \ref memUsedPool.
336
341
* \post
337
- * \ref poolTotalFree is updated
338
- * \bug calls outOfMemory, that can stack up endlessly
342
+ * - \ref poolTotalFree is updated
343
+ * - Exit on out-of-memory (the \ref memFreePool overflows)
339
344
*/
340
345
void poolFree (void * ptr );
341
346
/*!
@@ -363,7 +368,7 @@ void poolFree(void *ptr);
363
368
* \post
364
369
* - \ref poolTotalFree is the current free space in bytes in both pools.
365
370
* - A full \ref block is not added to \ref memUsedPool by this function.
366
- * \bug calls outOfMemory, that can stack up endlessly
371
+ * - Exit on out-of-memory (\ref memUsedPool overflows)
367
372
*/
368
373
void addToUsedPool (void * ptr );
369
374
/* Purges reset memory pool usage */
@@ -375,7 +380,7 @@ void memFreePoolPurge(flag untilOK);
375
380
*
376
381
* Return the overall statistics about the pools \ref memFreePool
377
382
* "free block array" and the \ref memUsedPool "used block array". In MEMORY
378
- * STATUS mode ON, a diagnostic message compares the the contents of
383
+ * STATUS mode ON, a diagnostic message compares the contents of
379
384
* \ref poolTotalFree to the values found in this statistics. They should not
380
385
* differ!
381
386
*
@@ -406,7 +411,7 @@ long getFreeSpace(long max);
406
411
/* Fatal memory allocation error */
407
412
/*!
408
413
* \fn outOfMemory(const char *msg)
409
- * \brief fatal memory allocation error.
414
+ * \brief exit after fatal memory allocation error.
410
415
*
411
416
* called when memory cannot be allocated, either because memory/address space
412
417
* is physically exhausted, or because administrative structures would overflow.
@@ -664,12 +669,27 @@ long compressedProofSize(const nmbrString *proof, long statemNum);
664
669
/*!
665
670
* \var long g_pntrTempAllocStackTop
666
671
*
667
- * Index of the current top af the \ref stack "stack" \ref pntrTempAlloc.
672
+ * Index of the current top of the \ref stack "stack" \ref pntrTempAlloc.
668
673
* New data is pushed from this location on if space available.
669
674
*
670
675
* \invariant always refers the null pointer element behind the valid data.
671
676
*/
672
677
extern long g_pntrTempAllocStackTop ; /* Top of stack for pntrTempAlloc function */
678
+ /*!
679
+ * \var long g_pntrTempAllocStackStart
680
+ *
681
+ * Index of the first entry of the \ref stack "stack" \ref pntrTempAllocStack
682
+ * eligible for deallocation on the next call to \ref pntrTempAlloc. Entries
683
+ * below this value are considered not dependent on the value at this index,
684
+ * but entries above are. So when this entry gets deallocated, dependent ones
685
+ * should follow suit. A function like \ref pntrTempAlloc or \ref pntrLet
686
+ * manage this automatic deallocation.
687
+ * \n
688
+ * Nested functions using the \ref pntrTempAllocStack usually save the current
689
+ * value and set it to \ref g_pntrTempAllocStackTop, so they can create their
690
+ * local dependency chain. On return the saved value is restored.
691
+ * \invariant always less or equal to \ref g_pntrTempAllocStackTop.
692
+ */
673
693
extern long g_pntrStartTempAllocStack ; /* Where to start freeing temporary
674
694
allocation when pntrLet() is called (normally 0, except for nested
675
695
pntrString functions) */
@@ -698,7 +718,8 @@ temp_pntrString *pntrMakeTempAlloc(pntrString *s);
698
718
* \post
699
719
* - the \ref block \p target points to is filled with a copy of
700
720
* \ref pntrString elements \p source points to, padded with a terminal
701
- * NULL, or an outOfMemory error is raised.
721
+ * NULL.
722
+ * - Exit on out-of-memory
702
723
* - due to a possible reallocation the pointer \p target points to may
703
724
* change.
704
725
*/
0 commit comments