This commit is contained in:
Vitor Santos Costa
2018-09-14 17:43:36 +01:00
parent f8d0703983
commit 46a32fbd83
5 changed files with 34 additions and 11 deletions

View File

@@ -42,6 +42,12 @@ static char SccsId[] = "%W% %G%";
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -383,6 +389,16 @@ void Yap_InitHeap(void *heap_addr) {
HeapMax = 0;
}
// get an approximation to total memory data-base size.
size_t Yap_HeapUsed(void)
{
#if HAVE_MALLINFO
struct mallinfo mi = mallinfo();
return mi.uordblks - (LOCAL_TrailTop-LOCAL_GlobalBase);
#endif
return Yap_ClauseSpace+Yap_IndexSpace_Tree+Yap_LUClauseSpace+Yap_LUIndexSpace_CP;
}
static void InitExStacks(int wid, int Trail, int Stack) {
CACHE_REGS
UInt pm, sa;