[ofw] RE: [PATCH] NDProvider: Use private heap for memory allocations

Fab Tillier ftillier at windows.microsoft.com
Wed May 20 15:01:34 PDT 2009


> Caching registrations is prone to errors.  See the general list for a
> current discussion on the topic.

The OS has to help you so that you can retire cache entries when the pages are freed.  Windows provides this functionality.

> The more general question is what heap are libraries expected to use?
> I
> couldn't find any documentation that indicated using or not using the
> process
> heap.  If it's recommended that libraries use the process heap, or
> there's no
> recommendation at all, then IMO the existing registration caches should
> be
> modified to avoid the issue.

Which heap you use is up to you.  The SecureMemoryCacheCallback requires that you don't touch the heap for which memory is being released.  If use your own private heap, you have control over what memory is getting registered vs. not.

See the MSDN docs for the documentation of SecureMemoryCacheCallback for all the details.

-Fab




More information about the ofw mailing list