Changeset c20f9f in git


Ignore:
Timestamp:
Aug 30, 2016, 3:26:43 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
c37f6e7ebb2fc206c5ea1e81fee94f2635bcf64c
Parents:
8f95fa5a16bb8841f4212fe2ecdf0604c8f45bf9
Message:
search for memory leaks in ssiLink.cc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r8f95fa rc20f9f  
    46184618static BOOLEAN jjMEMORY(leftv res, leftv v)
    46194619{
     4620  // clean out "_":
     4621  sLastPrinted.CleanUp();
     4622  memset(&sLastPrinted,0,sizeof(sleftv));
     4623  // collect all info:
    46204624  omUpdateInfo();
    46214625  switch(((int)(long)v->Data()))
  • Singular/links/ssiLink.cc

    r8f95fa rc20f9f  
    333333{
    334334  ssiInfo *d=(ssiInfo*)l->data;
    335   int Ll=lSize(dd);
     335  int Ll=dd->nr;
    336336  fprintf(d->f_write,"%d ",Ll+1);
    337337  int i;
     
    376376  l=s_readint(d->f_read);
    377377  buf=(char*)omAlloc0(l+1);
    378   int c =s_getc(d->f_read); /* skip ' '*/
    379   int ll=s_readbytes(buf,l,d->f_read);
    380   //if (ll!=l) printf("want %d, got %d bytes\n",l,ll);
     378  int throwaway =s_getc(d->f_read); /* skip ' '*/
     379  throwaway=s_readbytes(buf,l,d->f_read);
     380  //if (throwaway!=l) printf("want %d, got %d bytes\n",l,throwaway);
    381381  buf[l]='\0';
    382382  return buf;
     
    440440    cf=nFindCoeffByName(cf_name);
    441441    if (cf==NULL)
    442     { Werror("cannot find cf:%s",cf_name);return NULL;}
     442    {
     443      Werror("cannot find cf:%s",cf_name);
     444      omFree(cf_name);
     445      return NULL;
     446    }
    443447  }
    444448  if (N!=0)
     
    665669  int nr;
    666670  nr=s_readint(d->f_read);
    667   lists L=(lists)omAlloc(sizeof(*L));
     671  lists L=(lists)omAlloc0Bin(slists_bin);
    668672  L->Init(nr);
    669673
    670674  int i;
    671675  leftv v;
    672   for(i=0;i<nr;i++)
     676  for(i=0;i<=L->nr;i++)
    673677  {
    674678    v=ssiRead1(l);
     
    717721{
    718722  ssiInfo *d=(ssiInfo*)l->data;
    719   int throwaway;
    720   throwaway=s_readint(d->f_read);
     723  int throwaway=s_readint(d->f_read);
    721724  char *name=ssiReadString(d);
    722725  int tok;
     
    732735    Werror("blackbox %s not found",name);
    733736  }
     737  omFree(name);
    734738}
    735739
     
    748752  memcpy(res,tmp,sizeof(sleftv));
    749753  memset(tmp,0,sizeof(sleftv));
    750   omFreeSize(tmp,sizeof(sleftv));
     754  omFreeBin(tmp,sleftv_bin);
    751755  if (nr_of_attr>0)
    752756  {
     
    778782
    779783    SI_LINK_SET_OPEN_P(l, flag);
     784    if(l->data!=NULL) omFreeSize(l->data,sizeof(ssiInfo));
    780785    l->data=d;
    781786    omFree(l->mode);
     
    12371242{
    12381243  ssiInfo *d = (ssiInfo *)l->data;
    1239   leftv res=(leftv)omAlloc0(sizeof(sleftv));
     1244  leftv res=(leftv)omAlloc0Bin(sleftv_bin);
    12401245  int t=0;
    12411246  t=s_readint(d->f_read);
     
    12671272               ssiSetCurrRing(d->r);
    12681273             }
    1269              if (t==15) return ssiRead1(l);
     1274             if (t==15) // setring
     1275             {
     1276               omFreeBin(res,sleftv_bin);
     1277               return ssiRead1(l);
     1278             }
    12701279           }
    12711280           break;
     
    13521361                si_opt_1=n98_o1;
    13531362                si_opt_2=n98_o2;
     1363                omFreeBin(res,sleftv_bin);
    13541364                return ssiRead1(l);
    13551365             }
    1356     case 99: ssiClose(l); m2_end(0);
     1366    case 99: omFreeBin(res,sleftv_bin); ssiClose(l); m2_end(0);
    13571367    case 0: if (s_iseof(d->f_read))
    13581368            {
     
    13621372            break;
    13631373    default: Werror("not implemented (t:%d)",t);
    1364              omFreeSize(res,sizeof(sleftv));
     1374             omFreeBin(res,sleftv_bin);
    13651375             res=NULL;
    13661376             break;
     
    13761386  return res;
    13771387no_ring: WerrorS("no ring");
    1378   omFreeSize(res,sizeof(sleftv));
     1388  omFreeBin(res,sleftv_bin);
    13791389  return NULL;
    13801390}
     
    17851795  sprintf(buf,"ssi:connect %s:%s",host,port);
    17861796  slInit(l, buf);
     1797  omFreeSize(buf,256);
    17871798  if (slOpen(l,SI_LINK_OPEN,NULL)) return 1;
    17881799  SI_LINK_SET_RW_OPEN_P(l);
  • omalloc/omStats.c

    r8f95fa rc20f9f  
    4646#endif
    4747
    48   om_Info.UsedBytes = om_Info.UsedBytesMalloc + om_Info.UsedBytesFromValloc;
     48  om_Info.UsedBytes = om_Info.UsedBytesMalloc + om_Info.UsedBytesFromValloc - om_Info.InternalUsedBytesMalloc;
    4949  om_Info.AvailBytes = om_Info.AvailBytesMalloc + om_Info.AvailBytesFromValloc;
    5050
Note: See TracChangeset for help on using the changeset viewer.