-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CVS-154697, Windows implementation for malloc_trim(0) #2854
Closed
Closed
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9b8f83d
CVS-154698, Implement windows specific status codes
18582088138 e5b13a5
remove redundant code
18582088138 9e2bf85
fix clang-format check
18582088138 985a445
CVS-154700, Implement LoadLibrary for windows with GetProcAddress - d…
18582088138 ecb587b
Merge branch 'win_ovms_cvs154700' of https://github.com/18582088138/x…
18582088138 6652865
Fix clang-format style check
18582088138 133a1e1
CVS-154697, Windows implementation for malloc_trim(0)
18582088138 ed32ee9
Merge branch 'win_ovms_cvs154697' of https://github.com/18582088138/x…
18582088138 799eee6
Fix clang-format check
18582088138 3604771
Merge branch 'openvinotoolkit:main' into win_ovms_cvs154697
18582088138 f036aaf
Merge branch 'openvinotoolkit:main' into win_ovms_cvs154697
18582088138 a3a4c73
issue fix for base branch
18582088138 8959c87
Merge branch 'openvinotoolkit:main' into win_ovms_cvs154697
18582088138 a8b06a7
Merge branch 'main' into win_ovms_cvs154697
18582088138 e162f4c
Merge branch 'main' into win_ovms_cvs154697
18582088138 34b6e08
Merge branch 'main' into win_ovms_cvs154697
18582088138 3af51db
Merge branch 'main' into win_ovms_cvs154697
18582088138 78702c4
Merge branch 'main' into win_ovms_cvs154697
18582088138 1b8d57d
Merge branch 'main' into win_ovms_cvs154697
18582088138 f2557c5
Merge branch 'main' into win_ovms_cvs154697
18582088138 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,13 +26,36 @@ namespace ovms { | |
FunctorSequenceCleaner::FunctorSequenceCleaner(GlobalSequencesViewer& globalSequencesViewer) : | ||
globalSequencesViewer(globalSequencesViewer) {} | ||
|
||
#ifdef _WIN32 | ||
bool malloc_trim_win() { | ||
HANDLE heap = GetProcessHeap(); | ||
if (heap == NULL) { | ||
std::cerr << "Failed to get process heap" << std::endl; | ||
return false; | ||
} | ||
|
||
ULONG_PTR freed_bytes = HeapCompact(heap, 0); | ||
if (freed_bytes == 0) { | ||
DWORD error = GetLastError(); | ||
if (error != 0) { | ||
std::cerr << "HeapCompact failed with error: " << error << std::endl; | ||
return false; | ||
} | ||
} | ||
std::cout << "HeapCompact freed " << freed_bytes << " bytes" << std::endl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SPDLOG_INFO |
||
return true; | ||
} | ||
#endif | ||
|
||
void FunctorSequenceCleaner::cleanup() { | ||
globalSequencesViewer.removeIdleSequences(); | ||
SPDLOG_TRACE("malloc_trim(0)"); | ||
#ifdef __linux__ | ||
malloc_trim(0); | ||
#endif | ||
#elif _WIN32 | ||
// TODO: windows for malloc_trim(0); | ||
malloc_trim_win(); | ||
#endif | ||
} | ||
|
||
FunctorSequenceCleaner::~FunctorSequenceCleaner() = default; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use: SPDLOG_TRACE, SPDLOG_ERROR