Ignore:
Timestamp:
Mar 22, 2008, 10:39:25 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Get rid of jmalloc and replace it with standard malloc. Modern operating systems certainly perform a lot better than this custom implementation, and we have superior tools (eg. valgrind) to debug and profile memory usage without interfering with the code itself.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/morph.cpp

    r124 r129  
    119119
    120120  patches=frames;
    121   pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"morph::patch array");
     121  pats=(morph_patch *)malloc(sizeof(morph_patch)*patches);
    122122  w=max(bound_x2(0),bound_x2(1));
    123123  h=max(bound_y2(0),bound_y2(1));
     
    261261
    262262
    263   middle_map=(morph_point8 **)jmalloc(w*h*sizeof(morph_point8 *),
    264                       "morph::middle_map");  // create an image of pointers
    265   end_map=(unsigned char *)jmalloc(w*h,
    266                   "morph::end_map");      // maps all the ending pixels
     263  // create an image of pointers
     264  middle_map=(morph_point8 **)malloc(w*h*sizeof(morph_point8 *));
     265  // maps all the ending pixels
     266  end_map=(unsigned char *)malloc(w*h);
    267267
    268268  for (frame_on=2;frame_on<frames-1;frame_on++)
     
    349349  }
    350350
    351   jfree(middle_map);
    352   jfree(end_map);
     351  free(middle_map);
     352  free(end_map);
    353353
    354354}
     
    364364  if (e->type==SPEC_MORPH_POINTS_8 || e->type==SPEC_PATCHED_MORPH)
    365365  {
    366     p=(void *)jmalloc(sizeof(morph_point8)*total,"morph8::point array");
     366    p=(void *)malloc(sizeof(morph_point8)*total);
    367367    fp->read(p,sizeof(morph_point8)*total);
    368368    small=1;
     
    370370  else
    371371  {
    372     p=(void *)jmalloc(sizeof(morph_point16)*total,"morph16::point array");
     372    p=(void *)malloc(sizeof(morph_point16)*total);
    373373
    374374    for (i=0;i<total;i++)
     
    544544  }
    545545  if (small)
    546     plist=(void *)jmalloc(sizeof(morph_point8)*total,"morph8::point array");
     546    plist=(void *)malloc(sizeof(morph_point8)*total);
    547547  else
    548     plist=(void *)jmalloc(sizeof(morph_point16)*total,"morph16::point array");
     548    plist=(void *)malloc(sizeof(morph_point16)*total);
    549549  CHECK(plist);
    550550  for (i=0,color=0;i<total_hints;i++)
     
    734734
    735735  total=mor->total_points();
    736   points=(step_struct *)jmalloc(sizeof(step_struct)*total,"step_morph::points");
     736  points=(step_struct *)malloc(sizeof(step_struct)*total);
    737737
    738738  dir=frame_direction;
     
    897897
    898898  patches=fp->read_uint16();
    899   pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"patched_morph::points");
     899  pats=(morph_patch *)malloc(sizeof(morph_patch)*patches);
    900900
    901901  for (i=0;i<patches;i++)
     
    904904    if (pats[i].patches)
    905905    {
    906       pats[i].patch_data=(unsigned char *)jmalloc(3*pats[i].patches,"patched_morph::patch_data");
     906      pats[i].patch_data=(unsigned char *)malloc(3*pats[i].patches);
    907907      fp->read(pats[i].patch_data,3*pats[i].patches);
    908908    }
Note: See TracChangeset for help on using the changeset viewer.