Ignore:
Timestamp:
Jan 29, 2010 10:10:49 AM (14 years ago)
Author:
bennylp
Message:

Fixed ticket #1037: Memory pool alignment error when alignment is set to be greater than the default (thanks John Ridges for the report):

  • fixed the pool allocation routines in PJLIB,
  • add alignment test in pjlib-test (only useful if PJ_POOL_ALIGNMENT is configured in config_site.h),
  • fixed other pool tests in pjlib-test which are broken when PJ_POOL_ALIGNMENT is enlarged
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pjlib-test/pool_perf.c

    r2394 r3081  
    128128    /* Initialize size of chunks to allocate in for the test. */ 
    129129    for (i=0; i<COUNT; ++i) { 
     130        unsigned aligned_size; 
    130131        sizes[i] = MIN_SIZE + (pj_rand() % MAX_SIZE); 
    131         total_size += sizes[i]; 
     132        aligned_size = sizes[i]; 
     133        if (aligned_size & (PJ_POOL_ALIGNMENT-1)) 
     134            aligned_size = ((aligned_size + PJ_POOL_ALIGNMENT - 1)) & ~(PJ_POOL_ALIGNMENT - 1); 
     135        total_size += aligned_size; 
    132136    } 
    133137 
Note: See TracChangeset for help on using the changeset viewer.