Changeset: c8e6e2e252ab for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8e6e2e252ab
Modified Files:
monetdb5/mal/mal_recycle.c
Branch: Aug2011
Log Message:
chooseVictims: do not use alloca
diffs (33 lines):
diff --git a/monetdb5/mal/mal_recycle.c b/monetdb5/mal/mal_recycle.c
--- a/monetdb5/mal/mal_recycle.c
+++ b/monetdb5/mal/mal_recycle.c
@@ -420,8 +420,7 @@
(void) cntxt;
- wben = (dbl *)alloca(sizeof(dbl)*ltop);
- memset(wben,0, sizeof(dbl)*ltop);
+ wben = (dbl *)GDKzalloc(sizeof(dbl)*ltop);
for (l = 0; l < ltop; l++){
sz = recycleBlk->profiler[lvs[l]].wbytes;
switch(rcachePolicy){
@@ -434,8 +433,10 @@
wben[l] = sz? ben / sz : -1;
totmem += sz;
}
- if (totmem <= wr) /* all leaves need to be dropped */
+ if (totmem <= wr) { /* all leaves need to be dropped */
+ GDKfree(wben);
return ltop;
+ }
/* reorder instructions on increasing weighted credit */
/* knapsack: find a set with biggest wben fitting in totmem-wr.
@@ -501,6 +502,7 @@
mnstr_printf(cntxt->fdout,"Don't drop critical item :
instruction %d, credit %f\n" ,tmpl,ci_ben);
#endif
}
+ GDKfree(wben);
return newtop;
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list