1999-12-29
1999-12-29 21:22:47 by Martin Stjernholm <mast@lysator.liu.se>
-
aed42d7a00cbc83b3dd3cb226a284ea2d79ccb2a
(52 lines)
(+33/-19)
[
Show
| Annotate
]
Branch: 7.9
Fixed leak with resolve_cache.
Rev: src/program.c:1.193
5:
\*/
/**/
#include "global.h"
- RCSID("$Id: program.c,v 1.192 1999/12/28 01:18:43 hubbe Exp $");
+ RCSID("$Id: program.c,v 1.193 1999/12/29 21:22:47 mast Exp $");
#include "program.h"
#include "object.h"
#include "dynamic_buffer.h"
421:
else
{
if(!resolve_cache)
- resolve_cache=allocate_mapping(10);
+ resolve_cache=dmalloc_touch(struct mapping *, allocate_mapping(10));
mapping_string_insert(resolve_cache,ident,sp-1);
if(!(IS_ZERO(sp-1) && sp[-1].subtype==1))
1220:
toss_compilation_resources();
+ CDFPRINTF((stderr,
+ "th(%ld),end_first_pass(): compilation_depth:%d, compiler_pass:%d\n",
+ (long)th_self(), compilation_depth, compiler_pass));
+
+ if(!compiler_frame && (compiler_pass==2 || !prog) && resolve_cache)
+ {
+ free_mapping(dmalloc_touch(struct mapping *, resolve_cache));
+ resolve_cache=0;
+ }
+
#ifdef SHARED_NODES
/* free(node_hash.table); */
#endif /* SHARED_NODES */
1233:
exit_threads_disable(NULL);
- CDFPRINTF((stderr,
- "th(%ld),end_first_pass(): compilation_depth:%d, compiler_pass:%d\n",
- (long)th_self(), compilation_depth, compiler_pass));
-
+
free_all_nodes();
- if(!compiler_frame && compiler_pass==2 && resolve_cache)
- {
- free_mapping(resolve_cache);
- resolve_cache=0;
- }
+
return prog;
}
2414:
struct identifier *fun;
int i,t;
+ #if 0
CDFPRINTF((stderr,"th(%ld) Trying to find %s flags=%d\n",
(long)th_self(),name->str, flags));
-
+ #endif
#ifdef PIKE_DEBUG
if (!prog) {
2982:
p=end_first_pass(0);
- if(p)
- {
+
#ifdef PIKE_DEBUG
if (compilation_depth != -1) {
fprintf(stderr, "compile(): compilation_depth is %d at end of pass 1.\n",
2991:
}
#endif /* PIKE_DEBUG */
+ if(p)
+ {
low_start_new_program(p,0,0);
free_program(p);
p=0;
3011:
yyparse(); /* Parse da program again */
p=end_program();
+
+ #ifdef PIKE_DEBUG
+ if (compilation_depth != -1) {
+ fprintf(stderr, "compile(): compilation_depth is %d at end of pass 2.\n",
+ compilation_depth);
}
-
+ #endif /* PIKE_DEBUG */
+ }
#ifdef PIKE_DEBUG
if (threads_disabled != saved_threads_disabled) {
3041:
used_modules = used_modules_save;
num_used_modules = num_used_modules_save ;
error_handler = saved_handler;
+ #ifdef PIKE_DEBUG
+ if (resolve_cache) fatal("resolve_cache not freed at end of compilation.\n");
+ #endif
resolve_cache = resolve_cache_save;
#ifdef PIKE_DEBUG
3247: Inside #if defined(DO_PIKE_CLEANUP)
#ifdef DO_PIKE_CLEANUP
if(resolve_cache)
{
- free_mapping(resolve_cache);
+ free_mapping(dmalloc_touch (struct mapping *, resolve_cache));
resolve_cache=0;
}