Changeset 101142 in vbox for trunk/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
- Timestamp:
- Sep 18, 2023 11:12:16 AM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
r99779 r101142 550 550 551 551 /** 552 * Allocates one or more pages off the heap.552 * Frees an allocation. 553 553 * 554 554 * @returns IPRT status code. 555 * @retval VERR_NOT_FOUND if pv isn't within any of the memory blocks in the 556 * heap. 557 * @retval VERR_INVALID_POINTER if the given memory range isn't exactly one 558 * allocation block. 555 559 * @param pHeap The page heap. 556 560 * @param pv Pointer to what RTHeapPageAlloc returned. … … 652 656 } 653 657 else 654 rc = VERR_ INVALID_POINTER;658 rc = VERR_NOT_FOUND; /* Distinct return code for this so rtMemPagePosixFree and others can try alternative heaps. */ 655 659 656 660 RTCritSectLeave(&pHeap->CritSect); … … 737 741 * Free memory allocated by rtMemPagePosixAlloc. 738 742 * 739 * @param pv The address of the memory to free. 740 * @param cb The size. 741 * @param pHeap The heap. 742 */ 743 static void rtMemPagePosixFree(void *pv, size_t cb, PRTHEAPPAGE pHeap) 743 * @param pv The address of the memory to free. 744 * @param cb The size. 745 * @param pHeap1 The most probable heap. 746 * @param pHeap2 The less probable heap. 747 */ 748 static void rtMemPagePosixFree(void *pv, size_t cb, PRTHEAPPAGE pHeap1, PRTHEAPPAGE pHeap2) 744 749 { 745 750 /* … … 763 768 else 764 769 { 765 int rc = RTHeapPageFree(pHeap, pv, cb >> PAGE_SHIFT); 770 int rc = RTHeapPageFree(pHeap1, pv, cb >> PAGE_SHIFT); 771 if (rc == VERR_NOT_FOUND) 772 rc = RTHeapPageFree(pHeap2, pv, cb >> PAGE_SHIFT); 766 773 AssertRC(rc); 767 774 } … … 787 794 { 788 795 AssertReturn(!(fFlags & ~RTMEMPAGEALLOC_F_VALID_MASK), NULL); 789 return rtMemPagePosixAlloc(cb, pszTag, fFlags, &g_MemPagePosixHeap); 796 return rtMemPagePosixAlloc(cb, pszTag, fFlags, 797 !(fFlags & RTMEMPAGEALLOC_F_EXECUTABLE) ? &g_MemPagePosixHeap : &g_MemExecPosixHeap); 790 798 } 791 799 … … 793 801 RTDECL(void) RTMemPageFree(void *pv, size_t cb) RT_NO_THROW_DEF 794 802 { 795 r eturn rtMemPagePosixFree(pv, cb, &g_MemPagePosixHeap);796 } 797 803 rtMemPagePosixFree(pv, cb, &g_MemPagePosixHeap, &g_MemExecPosixHeap); 804 } 805
Note:
See TracChangeset
for help on using the changeset viewer.