Implemented fix as described by Hitoshi Tanaka for the problem that causes "Warning - approaching max data size...." to be erroneously reported when compiled with MinGW/MSYS
This commit is contained in:
parent
96657c618a
commit
b96b9aac28
|
|
@ -17,6 +17,7 @@ $Id$
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
#include "CKTdefs.h"
|
||||||
|
|
||||||
#ifdef XSPICE
|
#ifdef XSPICE
|
||||||
/* gtri - add - 12/12/90 - wbk - include ipc stuff */
|
/* gtri - add - 12/12/90 - wbk - include ipc stuff */
|
||||||
|
|
@ -126,41 +127,33 @@ char* copyword;
|
||||||
void
|
void
|
||||||
ft_ckspace(void)
|
ft_ckspace(void)
|
||||||
{
|
{
|
||||||
long usage, limit;
|
size_t usage;
|
||||||
|
size_t limit;
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE__MEMAVL
|
#ifdef HAVE__MEMAVL
|
||||||
size_t mem_avail_now;
|
size_t mem_avail_now;
|
||||||
|
|
||||||
mem_avail_now = _memavl( );
|
mem_avail_now = _memavl( );
|
||||||
usage = mem_avail - mem_avail_now;
|
usage = mem_avail - mem_avail_now;
|
||||||
limit = mem_avail;
|
limit = mem_avail;
|
||||||
#else
|
#else /* HAVE__MEMAVL */
|
||||||
|
|
||||||
static long old_usage = 0;
|
static long old_usage = 0;
|
||||||
char *hi;
|
char *hi;
|
||||||
|
|
||||||
# ifdef HAVE_GETRLIMIT
|
# ifdef HAVE_GETRLIMIT
|
||||||
|
|
||||||
struct rlimit rld;
|
struct rlimit rld;
|
||||||
getrlimit(RLIMIT_DATA, &rld);
|
getrlimit(RLIMIT_DATA, &rld);
|
||||||
if (rld.rlim_cur == RLIM_INFINITY)
|
if (rld.rlim_cur == RLIM_INFINITY)
|
||||||
return;
|
return;
|
||||||
limit = rld.rlim_cur - (enddata - startdata); /* rlim_max not used */
|
limit = rld.rlim_cur - (enddata - startdata); /* rlim_max not used */
|
||||||
|
# else /* HAVE_GETRLIMIT */
|
||||||
# else
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* SYSVRLIMIT */
|
/* SYSVRLIMIT */
|
||||||
limit = ulimit(3, 0L) - (enddata - startdata);
|
limit = ulimit(3, 0L) - (enddata - startdata);
|
||||||
|
# endif /* HAVE_GETRLIMIT */
|
||||||
# endif
|
|
||||||
hi=sbrk(0);
|
hi=sbrk(0);
|
||||||
usage = (long) (hi - enddata);
|
usage = (long) (hi - enddata);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (limit < 0)
|
if (limit < 0)
|
||||||
return; /* what else do you do? */
|
return; /* what else do you do? */
|
||||||
|
|
||||||
|
|
@ -168,12 +161,11 @@ ft_ckspace(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
old_usage = usage;
|
old_usage = usage;
|
||||||
|
#endif /* HAVE__MEMAVL */
|
||||||
#endif
|
|
||||||
|
|
||||||
if (usage > limit * 0.9) {
|
if (usage > limit * 0.9) {
|
||||||
fprintf(cp_err, "Warning - approaching max data size: ");
|
fprintf(cp_err, "Warning - approaching max data size: ");
|
||||||
fprintf(cp_err, "current size = %ld, limit = %ld.\n", usage, limit);
|
fprintf(cp_err, "current size = %ld, limit = %ld.\n", (long)usage, (long)limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -386,7 +378,7 @@ printres(char *name)
|
||||||
/* begin cider integration */
|
/* begin cider integration */
|
||||||
/* Now print out interesting stuff about numerical devices. */
|
/* Now print out interesting stuff about numerical devices. */
|
||||||
if (!name || eq(name, "devices")) {
|
if (!name || eq(name, "devices")) {
|
||||||
(void) NDEVacct(ft_curckt->ci_ckt, cp_out);
|
(void) NDEVacct((CKTcircuit*)ft_curckt->ci_ckt, cp_out);
|
||||||
yy = TRUE;
|
yy = TRUE;
|
||||||
}
|
}
|
||||||
/* end cider integration */
|
/* end cider integration */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue