outheap removed

This commit is contained in:
h_vogt 2012-02-11 12:50:44 +00:00
parent 5d101f46f9
commit fc7692a896
5 changed files with 4 additions and 157 deletions

View File

@ -64,15 +64,6 @@ static void freeRun(runDesc *run);
#endif
/*saj*/
/* plot output data shall go into extra heap
to prevent massive memory fragmentation of standard process heap.
This is especially required by TCL for Windows, but may help
also under standard Windows GUI. */
#if 0 && (defined(HAS_TCLWIN)) && ((defined(_MSC_VER) || defined(__MINGW32__)))
#define newrealloc hrealloc
#else
#define newrealloc trealloc
#endif
#define DOUBLE_PRECISION 15
@ -1010,12 +1001,12 @@ plotAddRealValue(dataDesc *desc, double value)
struct dvec *v = desc->vec;
if (isreal(v)) {
v->v_realdata = (double *) newrealloc(v->v_realdata,
v->v_realdata = (double *) trealloc(v->v_realdata,
sizeof(double) * (size_t) (v->v_length + 1));
v->v_realdata[v->v_length] = value;
} else {
/* a real parading as a VF_COMPLEX */
v->v_compdata = (ngcomplex_t *) newrealloc(v->v_compdata,
v->v_compdata = (ngcomplex_t *) trealloc(v->v_compdata,
sizeof(ngcomplex_t) * (size_t) (v->v_length + 1));
v->v_compdata[v->v_length].cx_real = value;
v->v_compdata[v->v_length].cx_imag = 0.0;
@ -1031,7 +1022,7 @@ plotAddComplexValue(dataDesc *desc, IFcomplex value)
{
struct dvec *v = desc->vec;
v->v_compdata = (ngcomplex_t *) newrealloc(v->v_compdata,
v->v_compdata = (ngcomplex_t *) trealloc(v->v_compdata,
sizeof(ngcomplex_t) * (size_t) (v->v_length + 1));
v->v_compdata[v->v_length].cx_real = value.real;
v->v_compdata[v->v_length].cx_imag = value.imag;

View File

@ -22,14 +22,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "plotting/plotting.h"
#include "error.h" /* controlled_exit() */
#if 0 && defined(HAS_TCLWIN)
#if defined(_MSC_VER) || defined(__MINGW32__)
#undef BOOLEAN
#include <windows.h>
extern HANDLE outheap;
#endif
#endif
#ifdef XSPICE
/* gtri - begin - add function prototype for EVTfindvec */
struct dvec *EVTfindvec(char *node);
@ -821,17 +813,7 @@ vec_free_x(struct dvec *v)
}
}
if (v->v_name) tfree(v->v_name);
#if 0 && (defined(HAS_TCLWIN)) && ((defined(_MSC_VER) || defined(__MINGW32__)))
if (v->v_realdata) {
if (HeapValidate(outheap, 0, v->v_realdata))
HeapFree(outheap, 0, v->v_realdata);
else
tfree(v->v_realdata);
}
#else
if (v->v_realdata) tfree(v->v_realdata);
#endif
if (v->v_compdata) tfree(v->v_compdata);
tfree(v);
return;

View File

@ -14,14 +14,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
#include <tcl.h>
#endif
#if defined(HAS_WINDOWS) || (defined(HAS_TCLWIN) && 0)
#if defined(_MSC_VER) || defined(__MINGW32__)
#undef BOOLEAN
#include <windows.h>
extern HANDLE outheap;
#endif
#endif
/* Malloc num bytes and initialize to zero. Fatal error if the space can't
* be tmalloc'd. Return NULL for a request for 0 bytes.
*/
@ -55,53 +47,6 @@ tmalloc(size_t num)
return(s);
}
/* Original Berkeley Implementation */
/*
void *
tmalloc(size_t num)
{
void *s;
if (!num)
return NULL;
s = malloc((unsigned) num);
if (!s) {
fprintf(stderr,
"malloc: Internal Error: can't allocate %d bytes.\n", num);
exit(EXIT_BAD);
}
bzero(s, num);
return(s);
}
void *
trealloc(void *str, size_t num)
{
void *s;
if (!num) {
if (str)
free(str);
return NULL;
}
if (!str)
s = tmalloc(num);
else
s = realloc(str, (unsigned) num);
if (!s) {
fprintf(stderr,
"realloc: Internal Error: can't allocate %d bytes.\n", num);
exit(EXIT_BAD);
}
return(s);
}
*/
void *
trealloc(void *ptr, size_t num)
@ -138,49 +83,6 @@ trealloc(void *ptr, size_t num)
return(s);
}
/* realloc using the output heap.
Function is used in outitf.c to prevent heap fragmentation
An additional heap outheap is used to store the plot output data.
*/
#if 0 && defined(HAS_TCLWIN)
#if defined(_MSC_VER) || defined(__MINGW32__)
void *
hrealloc(void *ptr, size_t num)
{
void *s;
/*saj*/
#ifdef TCL_MODULE
Tcl_Mutex *alloc;
alloc = Tcl_GetAllocMutex();
#endif
if (!num) {
if (ptr)
free(ptr);
return NULL;
}
if (!ptr)
s = HeapAlloc(outheap, HEAP_ZERO_MEMORY, num);
else {
/*saj*/
#ifdef TCL_MODULE
Tcl_MutexLock(alloc);
#endif
s = HeapReAlloc(outheap, HEAP_ZERO_MEMORY, ptr, num);
/*saj*/
#ifdef TCL_MODULE
Tcl_MutexUnlock(alloc);
#endif
}
if (!s) {
fprintf(stderr,"HeapReAlloc: Internal Error: can't allocate %ld bytes.\n", (long)num);
exit(EXIT_FAILURE);
}
return(s);
}
#endif
#endif
void
txfree(void *ptr)

View File

@ -179,12 +179,6 @@ do {\
} while(0)
/* global handle for the output heap */
#if defined(_MSC_VER) || defined(__MINGW32__)
HANDLE outheap;
#endif
void tcl_stdflush(FILE *f);
int tcl_vfprintf(FILE *f, const char *fmt, va_list args);
#if defined(__MINGW32__) || defined(_MSC_VER)
@ -2243,16 +2237,6 @@ int Spice_Init(Tcl_Interp *interp) {
save_interp();
#if 0 && (defined(_MSC_VER) || defined(__MINGW32__))
/* create private heap for current process*/
outheap = HeapCreate(0, 10000000, 0);
if (!outheap) {
fprintf(stderr,"HeapCreate: Internal Error: can't allocate private output heap");
exit(EXIT_BAD);
}
#endif
{
int i;
char *key;

View File

@ -104,8 +104,6 @@ void winmessage(char*);
int p_r_i_n_t_f(const char * __format, ...);
int f_f_l_u_s_h( FILE * __stream); */
/* private heap for storing plot data */
HANDLE outheap;
/* --------------------------<history management>------------------------------ */
@ -931,17 +929,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
UpdateWindow( hwMain);
SetFocus( swString);
status = MakeArgcArgv(lpszCmdLine,&argc,&argv);
#if defined(HAS_TCLWIN)
/* create private heap for current process */
outheap = HeapCreate(0, 10000000, 0);
if (!outheap) {
fprintf(stderr,"HeapCreate: Internal Error: can't allocate private output heap");
winmessage("HeapCreate: Internal Error: can't allocate private output heap");
exit(1);
}
#endif
status = MakeArgcArgv(lpszCmdLine,&argc,&argv);
/* Wait until everything is settled */
WaitForIdle();