Changeset: 76f43125d2d6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/76f43125d2d6 Modified Files: monetdb5/modules/mal/clients.c monetdb5/optimizer/opt_mitosis.c Branch: default Log Message:
Be carefull converting between signed and unsigned types diffs (47 lines): diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c --- a/monetdb5/modules/mal/clients.c +++ b/monetdb5/modules/mal/clients.c @@ -307,15 +307,14 @@ CLTsetmemorylimit(Client cntxt, MalBlkPt limit = *getArgReference_int(stk,pci,1); } - if( limit > (int)(GDK_mem_maxsize / LL_CONSTANT(1048576)) ) - throw(MAL,"clients.setmemorylimit","Memory claim beyond physical memory "); - if( idx < 0 || idx > MAL_MAXCLIENTS) throw(MAL,"clients.setmemorylimit","Illegal session id"); if( is_int_nil(limit)) throw(MAL, "clients.setmemorylimit", "The memmory limit cannot be NULL"); if( limit < 0) throw(MAL, "clients.setmemorylimit", "The memmory limit cannot be negative"); + if( (size_t) limit > GDK_mem_maxsize / 1048576) + throw(MAL,"clients.setmemorylimit","Memory claim beyond physical memory"); MT_lock_set(&mal_contextLock); if (mal_clients[idx].mode == FREECLIENT) diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c --- a/monetdb5/optimizer/opt_mitosis.c +++ b/monetdb5/optimizer/opt_mitosis.c @@ -146,7 +146,7 @@ OPTmitosisImplementation(Client cntxt, M /* This code was used to experiment with block sizes, mis-using the memorylimit variable if (cntxt->memorylimit){ // the new mitosis scheme uses a maximum chunck size in MB from the client context - m = (size_t) ((cntxt->memorylimit * LL_CONSTANT(1048576)) / row_size); + m = (((size_t) cntxt->memorylimit) * 1048576) / (size_t) row_size; pieces = (int) (rowcnt / m + (rowcnt - m * pieces > 0)); } if (cntxt->memorylimit == 0 || pieces <= 1){ @@ -160,11 +160,11 @@ OPTmitosisImplementation(Client cntxt, M * and determine the column slice size */ if( cntxt->memorylimit) - m = cntxt->memorylimit * LL_CONSTANT(1048576) / argsize; + m = (((size_t) cntxt->memorylimit) * 1048576) / argsize; else { memclaim= MCmemoryClaim(); if(memclaim == GDK_mem_maxsize){ - m = GDK_mem_maxsize / MCactiveClients()/ argsize; + m = GDK_mem_maxsize / (size_t) MCactiveClients() / argsize; } else m = (GDK_mem_maxsize - memclaim) / argsize; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list