Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Untitled
Thursday, November 16th, 2006 at 3:10:06pm UTC 

  1. --- zend_alloc.c.orig   2006-11-13 11:30:56.000000000 +0000
  2. +++ zend_alloc.c        2006-11-16 15:08:36.811910300 +0000
  3. @@ -381,18 +381,19 @@
  4.  #define ZEND_MM_ALIGNED_SIZE(size)               ((size + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
  5.  #define ZEND_MM_ALIGNED_HEADER_SIZE            ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_block))
  6.  #define ZEND_MM_ALIGNED_FREE_HEADER_SIZE       ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_free_block))
  7. -#define ZEND_MM_ALIGNED_MIN_HEADER_SIZE                (sizeof(zend_mm_block)+END_MAGIC_SIZE>sizeof(zend_mm_free_block)?ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_block)+END_MAGIC_SIZE):ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_free_block)))
  8. +#define ZEND_MM_MIN_ALLOC_BLOCK_SIZE      ZEND_MM_ALIGNED_SIZE(ZEND_MM_ALIGNED_HEADER_SIZE + END_MAGIC_SIZE)
  9. +#define ZEND_MM_ALIGNED_MIN_FREE_SIZE    ((ZEND_MM_MIN_ALLOC_BLOCK_SIZE > ZEND_MM_ALIGNED_FREE_HEADER_SIZE)?(ZEND_MM_MIN_ALLOC_BLOCK_SIZE):(ZEND_MM_ALIGNED_FREE_HEADER_SIZE))
  10.  #define ZEND_MM_ALIGNED_SEGMENT_SIZE      ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_segment))
  11.  
  12. -#define ZEND_MM_MIN_SIZE                                   (ZEND_MM_ALIGNED_MIN_HEADER_SIZE-(ZEND_MM_ALIGNED_HEADER_SIZE+END_MAGIC_SIZE))
  13. +#define ZEND_MM_MIN_SIZE                                   (ZEND_MM_ALIGNED_MIN_FREE_SIZE-(ZEND_MM_ALIGNED_HEADER_SIZE+END_MAGIC_SIZE))
  14.  
  15. -#define ZEND_MM_MAX_SMALL_SIZE    (((ZEND_MM_NUM_BUCKETS-1)<<ZEND_MM_ALIGNMENT_LOG2)+ZEND_MM_ALIGNED_MIN_HEADER_SIZE)
  16. +#define ZEND_MM_MAX_SMALL_SIZE    (((ZEND_MM_NUM_BUCKETS-2)<<ZEND_MM_ALIGNMENT_LOG2)+ZEND_MM_ALIGNED_MIN_FREE_SIZE)
  17.  
  18. -#define ZEND_MM_TRUE_SIZE(size)                                (((long)size<(long)ZEND_MM_MIN_SIZE)?(ZEND_MM_ALIGNED_MIN_HEADER_SIZE):(ZEND_MM_ALIGNED_SIZE(size+ZEND_MM_ALIGNED_HEADER_SIZE+END_MAGIC_SIZE)))
  19. +#define ZEND_MM_TRUE_SIZE(size)                                (((long)size<(long)ZEND_MM_MIN_SIZE)?(ZEND_MM_ALIGNED_MIN_FREE_SIZE):(ZEND_MM_ALIGNED_SIZE(size+ZEND_MM_ALIGNED_HEADER_SIZE+END_MAGIC_SIZE)))
  20.  
  21. -#define ZEND_MM_BUCKET_INDEX(true_size)                ((true_size>>ZEND_MM_ALIGNMENT_LOG2)-(ZEND_MM_ALIGNED_MIN_HEADER_SIZE>>ZEND_MM_ALIGNMENT_LOG2)+1)
  22. +#define ZEND_MM_BUCKET_INDEX(true_size)                ((true_size>>ZEND_MM_ALIGNMENT_LOG2)-(ZEND_MM_ALIGNED_MIN_FREE_SIZE>>ZEND_MM_ALIGNMENT_LOG2)+1)
  23.  
  24. -#define ZEND_MM_SMALL_SIZE(true_size)    (true_size < ZEND_MM_MAX_SMALL_SIZE)
  25. +#define ZEND_MM_SMALL_SIZE(true_size)    (true_size <= ZEND_MM_MAX_SMALL_SIZE)
  26.  
  27.  /* Memory calculations */
  28.  #define ZEND_MM_BLOCK_AT(blk, offset)  ((zend_mm_block *) (((char *) (blk))+(offset)))
  29. @@ -584,10 +585,13 @@
  30.         zend_mm_heap    *heap;
  31.  
  32.  #if 0
  33. +{
  34. +       int i;
  35.         for (i = 0; i < ZEND_MM_MAX_SMALL_SIZE; i++) {
  36.                printf("%3d%c: %3ld %d %2ld\n", i, (i == ZEND_MM_MIN_SIZE?'*':' '), (long)ZEND_MM_TRUE_SIZE(i), ZEND_MM_SMALL_SIZE(ZEND_MM_TRUE_SIZE(i)), (long)ZEND_MM_BUCKET_INDEX(ZEND_MM_TRUE_SIZE(i)));
  37.         }
  38.         exit(0);
  39. +}
  40.  #endif
  41.  
  42.         storage = handlers->init(params);
  43. @@ -1163,7 +1167,7 @@
  44.                       size_t block_size = ZEND_MM_FREE_BLOCK_SIZE(best_fit);
  45.                       size_t remaining_size = block_size - true_size;
  46.  
  47. -                     if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
  48. +                     if (remaining_size < ZEND_MM_ALIGNED_MIN_FREE_SIZE) {
  49.                              ZEND_MM_BLOCK(best_fit, ZEND_MM_USED_BLOCK, block_size);
  50.                       } else {
  51.                              zend_mm_free_block *new_free_block;
  52. @@ -1241,7 +1245,7 @@
  53.  
  54.                ZEND_MM_LAST_BLOCK(ZEND_MM_BLOCK_AT(best_fit, block_size));
  55.  
  56. -              if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
  57. +              if (remaining_size < ZEND_MM_ALIGNED_MIN_FREE_SIZE) {
  58.                       ZEND_MM_BLOCK(best_fit, ZEND_MM_USED_BLOCK, block_size);
  59.                } else {
  60.                       zend_mm_free_block *new_free_block;
  61. @@ -1399,7 +1403,7 @@
  62.         if (true_size <= ZEND_MM_BLOCK_SIZE(mm_block)) {
  63.                size_t remaining_size = ZEND_MM_BLOCK_SIZE(mm_block) - true_size;
  64.  
  65. -              if (remaining_size >= ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
  66. +              if (remaining_size >= ZEND_MM_ALIGNED_MIN_FREE_SIZE) {
  67.                       zend_mm_free_block *new_free_block;
  68.  
  69.                       HANDLE_BLOCK_INTERRUPTIONS();
  70. @@ -1440,7 +1444,7 @@
  71.                       HANDLE_BLOCK_INTERRUPTIONS();
  72.                       zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
  73.  
  74. -                     if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
  75. +                     if (remaining_size < ZEND_MM_ALIGNED_MIN_FREE_SIZE) {
  76.                              ZEND_MM_BLOCK(mm_block, ZEND_MM_USED_BLOCK, block_size);
  77.                       } else {
  78.                              zend_mm_free_block *new_free_block;
  79. @@ -1540,7 +1544,7 @@
  80.                /* setup guard block */
  81.                ZEND_MM_LAST_BLOCK(ZEND_MM_BLOCK_AT(mm_block, block_size));
  82.  
  83. -              if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
  84. +              if (remaining_size < ZEND_MM_ALIGNED_MIN_FREE_SIZE) {
  85.                       ZEND_MM_BLOCK(mm_block, ZEND_MM_USED_BLOCK, block_size);
  86.                } else {
  87.                       zend_mm_free_block *new_free_block;

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right