Ignore:
Timestamp:
Mar 22, 2008, 10:39:25 AM (14 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/lisp/lisp.cpp

    r125 r129  
    2525#else
    2626#include "status.hpp"
    27 #include "jmalloc.hpp"
    2827#include "macs.hpp"
    2928#include "specs.hpp"
     
    862861     current_space=PERM_SPACE;       // make sure all symbols get defined in permanant space
    863862
    864   p=(lisp_symbol *)jmalloc(sizeof(lisp_symbol),"lsymbol");
     863  p=(lisp_symbol *)malloc(sizeof(lisp_symbol));
    865864  p->type=L_SYMBOL;
    866865  p->name=new_lisp_string(name);
     
    889888    ldelete_syms(root->left);
    890889    ldelete_syms(root->right);
    891     jfree(root);
     890    free(root);
    892891  }
    893892}
     
    16461645  if (!num_args) return 0;
    16471646
    1648   void **arg_on=(void **)jmalloc(sizeof(void *)*num_args,"mapcar tmp array");
     1647  void **arg_on=(void **)malloc(sizeof(void *)*num_args);
    16491648  cons_cell *list_on=(cons_cell *)CDR(arg_list);
    16501649  long old_ptr_son=l_ptr_stack.son;
     
    16611660  if (stop)
    16621661  {
    1663     jfree(arg_on);
     1662    free(arg_on);
    16641663    return NULL;
    16651664  }
     
    17041703  l_ptr_stack.son=old_ptr_son;
    17051704
    1706   jfree(arg_on);
     1705  free(arg_on);
    17071706  return return_list;
    17081707}
     
    17221721    else
    17231722    {
    1724       void **str_eval=(void **)jmalloc(elements*sizeof(void *),"tmp eval array");
     1723      void **str_eval=(void **)malloc(elements*sizeof(void *));
    17251724      int i,old_ptr_stack_start=l_ptr_stack.son;
    17261725
     
    17841783    }
    17851784      }
    1786       jfree(str_eval);
     1785      free(str_eval);
    17871786      l_ptr_stack.son=old_ptr_stack_start;   // restore pointer GC stack
    17881787      *s=0;
     
    24092408                {
    24102409                    char *gammapath;
    2411                     gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9 + 1, "gammapath" );
     2410                    gammapath = (char *)malloc( strlen( get_save_filename_prefix() ) + 9 + 1 );
    24122411                    sprintf( gammapath, "%sgamma.lsp", get_save_filename_prefix() );
    24132412                    fp = new jFILE( gammapath, "rb" );
    2414                     jfree( gammapath );
     2413                    free( gammapath );
    24152414                }
    24162415                else
     
    24342433            {
    24352434                long l=fp->file_size();
    2436                 char *s=(char *)jmalloc(l+1,"loaded script");
     2435                char *s=(char *)malloc(l + 1);
    24372436                if (!s)
    24382437                {
     
    24682467                if (stat_man) stat_man->pop();
    24692468            #endif
    2470                 jfree(s);
     2469                free(s);
    24712470                ret=fn;
    24722471      }
     
    32003199  } else if (free_space[TMP_SPACE]==space[TMP_SPACE])
    32013200  {
    3202     free_space[TMP_SPACE]=space[TMP_SPACE]=(char *)jrealloc(space[TMP_SPACE],new_size,"lisp tmp space");
     3201    free_space[TMP_SPACE]=space[TMP_SPACE]=(char *)realloc(space[TMP_SPACE],new_size);
    32033202    space_size[TMP_SPACE]=new_size;
    32043203    dprintf("Lisp : tmp space resized to %d\n",new_size);
     
    32123211  lsym_root=NULL;
    32133212  total_user_functions=0;
    3214   free_space[0]=space[0]=(char *)jmalloc(perm_size,"lisp perm space");
     3213  free_space[0]=space[0]=(char *)malloc(perm_size);
    32153214  space_size[0]=perm_size;
    32163215
    32173216
    3218   free_space[1]=space[1]=(char *)jmalloc(tmp_size,"lisp tmp space");
     3217  free_space[1]=space[1]=(char *)malloc(tmp_size);
    32193218  space_size[1]=tmp_size;
    32203219
     
    32343233void lisp_uninit()
    32353234{
    3236   jfree(space[0]);
    3237   jfree(space[1]);
     3235  free(space[0]);
     3236  free(space[1]);
    32383237  ldelete_syms(lsym_root);
    32393238  lsym_root=NULL;
Note: See TracChangeset for help on using the changeset viewer.