summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornelsonb%netscape.com <devnull@localhost>2001-03-31 00:47:41 +0000
committernelsonb%netscape.com <devnull@localhost>2001-03-31 00:47:41 +0000
commit7b9b5deedffff5074475d33b4c7d6d5ed0294792 (patch)
tree7e304ad51883f8441d52d8cb0786122716951853
parent51e504b90fc7c5141114ad272fccb240c4b91431 (diff)
downloadnss-hg-7b9b5deedffff5074475d33b4c7d6d5ed0294792.tar.gz
When NSS is being used with NSPR 4.1.1 and higher, put used Arena blocks
on the arena free list rather than freeing them to the heap.
-rw-r--r--security/nss/lib/util/secport.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/security/nss/lib/util/secport.c b/security/nss/lib/util/secport.c
index b6269967b..9b31e4f83 100644
--- a/security/nss/lib/util/secport.c
+++ b/security/nss/lib/util/secport.c
@@ -49,6 +49,7 @@
#include "prmon.h"
#include "nsslocks.h"
#include "secport.h"
+#include "prvrsion.h"
#ifdef DEBUG
#define THREADMARK
@@ -187,8 +188,6 @@ PORT_GetError(void)
/********************* Arena code follows *****************************/
-PZMonitor * arenaMonitor;
-
PLArenaPool *
PORT_NewArena(unsigned long chunksize)
{
@@ -262,11 +261,25 @@ PORT_FreeArena(PLArenaPool *arena, PRBool zero)
{
PORTArenaPool *pool = (PORTArenaPool *)arena;
PRLock * lock = (PRLock *)0;
+ extern const PRVersionDescription * libVersionPoint(void);
+ static const PRVersionDescription * pvd;
+ static PRBool doFreeArenaPool;
if (ARENAPOOL_MAGIC == pool->magic ) {
lock = pool->lock;
PZ_Lock(lock);
}
+ if (!pvd) {
+ /* no need for thread protection here */
+ pvd = libVersionPoint();
+ if ((pvd->vMajor > 4) ||
+ (pvd->vMajor == 4 && pvd->vMinor > 1) ||
+ (pvd->vMajor == 4 && pvd->vMinor == 1 && pvd->vPatch >= 1)) {
+ doFreeArenaPool = PR_TRUE;
+ }
+ }
+ if (doFreeArenaPool)
+ PL_FreeArenaPool(arena);
PL_FinishArenaPool(arena);
PORT_ZFree(pool, sizeof(*pool));
if (lock) {