winapi - Free a Windows heap without releasing memory pages -


i'm implementing heap pool utility , need pool_clear() function (like apache portable runtime apr_pool_clear()). functions allow free @ once (single function call) memory allocated on pool without releasing memory pages underlying system. windows api provides heapfree() (multiple function calls) , heapdestroy() (releases memory pages).

are there way on windows (using native api)?

heapcreate , other heap* functions kernel32 don't provide kind of power. meant provide same functionality c standard library, plus debugging/diagnostic features.

it sounds rtlcreateheap ntdll fit bill, allocating memory , specifying heapbase, initialcommit, initialreserve, , commitroutine.

this means can call rtldestroyheap without giving of virtual memory, then, call rtlcreateheap again same heapbase, effectively, creating new heap in same virtual memory

unfortunately, knowledge, these entry points in ntdll undocumented, as of native api, there risk associated calling it. linked documentation entry point in ntoskrnl drivers use. since explicitly call out using native api, maybe understand , accept sort of risk. in case, safer use library has implemented functionality.

if serious sort of thing (which, frankly, scares me), you'll want @ reactos's heap implementation supplement microsoft's documentation.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -