Branch: Tag:

1996-12-05

1996-12-05 00:47:58 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

fixed a small memory leak and added _memory_usage

Rev: bin/test_pike.pike:1.3
Rev: src/ChangeLog:1.32
Rev: src/array.c:1.4
Rev: src/array.h:1.2
Rev: src/builtin_functions.c:1.16
Rev: src/builtin_functions.h:1.3
Rev: src/callback.c:1.4
Rev: src/callback.h:1.3
Rev: src/constants.c:1.4
Rev: src/constants.h:1.2
Rev: src/language.yacc:1.15
Rev: src/las.c:1.10
Rev: src/las.h:1.3
Rev: src/mapping.c:1.8
Rev: src/mapping.h:1.2
Rev: src/modules/call_out/call_out.c:1.4
Rev: src/modules/pipe/pipe.c:1.7
Rev: src/multiset.c:1.2
Rev: src/multiset.h:1.2
Rev: src/object.c:1.6
Rev: src/object.h:1.4
Rev: src/program.c:1.11
Rev: src/program.h:1.4
Rev: src/stralloc.c:1.8
Rev: src/stralloc.h:1.4

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: las.c,v 1.9 1996/12/04 00:27:11 hubbe Exp $"); + RCSID("$Id: las.c,v 1.10 1996/12/05 00:47:14 hubbe Exp $");      #include "language.h"   #include "interpret.h"
36:   dynamic_buffer areas[NUM_AREAS];   node *init_node = 0;   int num_parse_error; + int cumulative_parse_error=0;   extern char *get_type_name(int);      #define MAX_GLOBAL 256
139:    {    node *tmp;    struct node_chunk *tmp2; - #ifdef DEBUG +     int e=0; -  +  +  +  if(cumulative_parse_error) +  { +     for(tmp2=node_chunks;tmp2;tmp2=tmp2->next) e+=NODES;    for(tmp=free_nodes;tmp;tmp=CAR(tmp)) e--;    if(e)
155: Inside #if defined(DEBUG)
   break;       if(!tmp) -  fprintf(stderr,"Free node at %p.\n",(tmp2->nodes+e)); +  { +  tmp=tmp2->nodes+e; + #ifdef DEBUG +  if(!cumulative_parse_error) +  { +  fprintf(stderr,"Free node at %p.\n",tmp);    } -  +  else + #endif +  { +  /* Free the node and be happy */ +  /* Make sure we don't free any nodes twice */ +  if(car_is_node(tmp)) CAR(tmp)=0; +  if(cdr_is_node(tmp)) CDR(tmp)=0; +  free_node(tmp);    } -  fatal("Failed to free %d nodes when compiling!\n",e2); +     } -  +  } +  } + #ifdef DEBUG +  if(!cumulative_parse_error) +  fatal("Failed to free %d nodes when compiling!\n",e2);   #endif -  +  } +  }    while(node_chunks)    {    tmp2=node_chunks;
168:    free((char *)tmp2);    }    free_nodes=0; +  cumulative_parse_error=0;    }   }