Annotation of parser3/src/main/pa_memory.C, revision 1.15
1.2 paf 1: /** @file
2: Parser: memory reference counting classes.
3:
1.14 moko 4: Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)
1.2 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
6: */
7:
8: #include "pa_sapi.h"
9: #include "pa_common.h"
10:
1.15 ! moko 11: volatile const char * IDENT_PA_MEMORY_C="$Id: pa_memory.C,v 1.14 2017/02/07 22:00:43 moko Exp $" IDENT_PA_MEMORY_H;
1.9 moko 12:
1.2 paf 13: void *pa_fail_alloc(const char* what, size_t size) {
14: #ifdef PA_DEBUG_DISABLE_GC
15: SAPI::die("out of memory (in pa_fail_alloc)");
16: #else
1.12 moko 17: SAPI::die("out of memory: failed to %s %u bytes. heap_used=%u, heap_free=%u, bytes_since_gc=%u, total_bytes=%u",
18: what, size, GC_get_heap_size(), GC_get_free_bytes(), GC_get_bytes_since_gc(), GC_get_total_bytes());
1.2 paf 19: #endif
20: // never reached
21: return 0;
22: }
1.12 moko 23:
24: #ifdef _MSC_VER
25: extern "C" void *pa_fail_alloc(const char* what);
26: void *pa_fail_alloc(const char* what) {
27: SAPI::die("fatal memory error: %s. heap_used=%u, heap_free=%u, bytes_since_gc=%u, total_bytes=%u",
28: what, GC_get_heap_size(), GC_get_free_bytes(), GC_get_bytes_since_gc(), GC_get_total_bytes());
29: // never reached
30: return 0;
31: }
32: #endif
E-mail: