Closed Bug 391244 Opened 17 years ago Closed 6 years ago

tracking - review memory menagement in libpkix

Categories

(NSS :: Libraries, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX
3.12.2

People

(Reporter: alvolkov.bgs, Assigned: alvolkov.bgs)

References

(Depends on 2 open bugs)

Details

(Whiteboard: PKIX)

LibPkix is designed so that every library function has a pointer to void as the last argument. Pointer to PKIX_PL_NssContext casted to void* is the actual data poiter that get passed to the library functions.

PRArenaPort* is one of the members of PKIX_PL_NssContext. If NssContext_Create is called with arena set to PKIX_TRUE, an arena pool will be created and used for majority of object allocations. 

There are two types of PKIX_PL_NssContext objects involved in operations of libpkix. First type is single global object that is allocated at pkix initialization time and mainly supposed to be used for cache memory allocations. Second type are PKIX_PL_NssContext objects allocated before every call of PKIX_BuildChain and used for new allocations during a particula cert chaing building or validation.

The design creates a problem when an arena is used by many threads to allocate multiple objects that will result in significant memory use growth as the most of the objects in cache wont be deallocated until library shutdown. Also, the cert/crl, etc date will need to be copied to global arena every time an object is cached.

As a part of this bug resolution one should deeply understand libpkix memory allocation. One of the possible solution is to use per object arena, but this approach will result in increased allocation sys calls.
Whiteboard: PKIX
Priority: -- → P1
valid Nelson's comment from bug 389904#c8 that also should be addressed in this bug.
Summary: libpkix: use PKIX_PL_NssContext arena can create a problem if used for PKIX_PL_Cert data allocation → review memory menagement in libpkix
Version: 3.12 → trunk
Depends on: 387024
Summary: review memory menagement in libpkix → tracking - review memory menagement in libpkix
Depends on: 391775
Target Milestone: 3.12 → 3.12.1
Target Milestone: 3.12.1 → 3.12.2
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.