summaryrefslogtreecommitdiff
path: root/pjlib/src/pjlib-test/pool_perf.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-01-29 10:10:49 +0000
committerBenny Prijono <bennylp@teluu.com>2010-01-29 10:10:49 +0000
commit8e54a92b6eb6302761fd9a1949086baa26e0007a (patch)
tree7aa9a3938e8fb52cb2970c25ed16e3091af2a9f8 /pjlib/src/pjlib-test/pool_perf.c
parent700fa9dc82720fbca9eacd67b7106ad254595911 (diff)
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 git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3081 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test/pool_perf.c')
-rw-r--r--pjlib/src/pjlib-test/pool_perf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pjlib/src/pjlib-test/pool_perf.c b/pjlib/src/pjlib-test/pool_perf.c
index 8bd5635f..d73f7a5b 100644
--- a/pjlib/src/pjlib-test/pool_perf.c
+++ b/pjlib/src/pjlib-test/pool_perf.c
@@ -127,8 +127,12 @@ int pool_perf_test()
/* Initialize size of chunks to allocate in for the test. */
for (i=0; i<COUNT; ++i) {
+ unsigned aligned_size;
sizes[i] = MIN_SIZE + (pj_rand() % MAX_SIZE);
- total_size += sizes[i];
+ aligned_size = sizes[i];
+ if (aligned_size & (PJ_POOL_ALIGNMENT-1))
+ aligned_size = ((aligned_size + PJ_POOL_ALIGNMENT - 1)) & ~(PJ_POOL_ALIGNMENT - 1);
+ total_size += aligned_size;
}
/* Add some more for pool admin area */