Diff for /parser3/src/targets/cgi/Attic/pa_pool.C between versions 1.19 and 1.30

version 1.19, 2001/09/15 13:20:22 version 1.30, 2001/10/29 17:01:37
Line 2 Line 2
         Parser: CGI memory manager impl.          Parser: CGI memory manager impl.
   
         Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
   
         Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)          Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
   
         $Id$          $Id$
Line 11 Line 10
 #include <stdlib.h>  #include <stdlib.h>
   
 #include "pa_pool.h"  #include "pa_pool.h"
   #include "pool_storage.h"
   
 //#define DEBUG_POOL_MALLOC  //#define DEBUG_POOL_MALLOC
   
Line 65 Line 65
 #include "pa_vvoid.h"  #include "pa_vvoid.h"
 #include "pa_wcontext.h"  #include "pa_wcontext.h"
 #include "pa_wwrapper.h"  #include "pa_wwrapper.h"
   #include "pa_dictionary.h"
   
 #define MALLOC_STAT_MAXSIZE (0x400*0x400)  #define MALLOC_STAT_MAXSIZE (0x400*0x400)
 #define MALLOC_STAT_PLACES 10  #define MALLOC_STAT_PLACES 20
   
 int malloc_times[MALLOC_STAT_PLACES][MALLOC_STAT_MAXSIZE];  int malloc_times[MALLOC_STAT_PLACES][MALLOC_STAT_MAXSIZE];
 int malloc_places[MALLOC_STAT_PLACES];  int malloc_places[MALLOC_STAT_PLACES];
Line 102  ST(Stack); Line 102  ST(Stack);
 ST(String);  ST(String);
 ST(Table);  ST(Table);
 ST(Temp_alias);  ST(Temp_alias);
 ST(Temp_exception);  
 ST(Temp_lang);  ST(Temp_lang);
 ST(Temp_method);  ST(Temp_method);
 ST(VAliased);  ST(VAliased);
Line 130  ST(VTable); Line 129  ST(VTable);
 ST(VVoid);  ST(VVoid);
 ST(WContext);  ST(WContext);
 ST(WWrapper);  ST(WWrapper);
   ST(Dictionary);
   
         for(int place=0; place<MALLOC_STAT_PLACES; place++)          for(int place=0; place<MALLOC_STAT_PLACES; place++)
                 if(malloc_places[place]) {                  if(malloc_places[place]) {
Line 157  ST(WWrapper); Line 156  ST(WWrapper);
 }  }
 #endif  #endif
   
 void *Pool::real_malloc(size_t size/*, int place*/) {  void *Pool::real_malloc(size_t size, int place) {
 #ifdef DEBUG_POOL_MALLOC  #ifdef DEBUG_POOL_MALLOC
   //place=0;
         int index=min(MALLOC_STAT_MAXSIZE-1, size);          int index=min(MALLOC_STAT_MAXSIZE-1, size);
         int place=0;  
         malloc_times[place][index]++;          malloc_times[place][index]++;
         malloc_places[place]++;          malloc_places[place]++;
 /*      if(size==9271)  /*      if(size==208 && place==10)
                 __asm int 3;*/                  __asm int 3;*/
 #endif  #endif
         return ::malloc(size);          return ::malloc(size);
Line 173  void *Pool::real_calloc(size_t size) { Line 172  void *Pool::real_calloc(size_t size) {
         return ::calloc(size, 1);          return ::calloc(size, 1);
 }  }
   
 void Pool::real_register_cleanup(void (*cleanup) (void *), void *data) {  bool Pool::real_register_cleanup(void (*cleanup) (void *), void *data) {
         /* we free nothing in CGI */          return fstorage!=0 && static_cast<Pool_storage *>(fstorage)->register_cleanup(cleanup, data);
 }  }
   

Removed from v.1.19  
changed lines
  Added in v.1.30


E-mail: