Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do gc.collect() in MemoryHook test code to avoid free hook to happen#9092

Merged
asi1024 merged 1 commit into
cupy:mainfrom
kmaehashi:fix-memory-hook-tests
Apr 8, 2025
Merged

Do gc.collect() in MemoryHook test code to avoid free hook to happen#9092
asi1024 merged 1 commit into
cupy:mainfrom
kmaehashi:fix-memory-hook-tests

Conversation

@kmaehashi

Copy link
Copy Markdown
Member

Closes #9077

I repeatedly ran the test locally but could not reproduce the origianl issue. My guess is that Python GC has triggered somewhere between with self.hook: and alloc_postprocess, which caused free_postprocess (for a memory block acquired in the previous test cases) to be triggered.

with self.hook:
mem = self.pool.malloc(size)

Adding gc.collect() to setUp to avoid free_* to be triggered.

@kmaehashi kmaehashi changed the title do gc.collect() to avoid free hook to happen Do gc.collect() in MemoryHook test code to avoid free hook to happen Apr 7, 2025
@kmaehashi

Copy link
Copy Markdown
Member Author

/test mini

@asi1024 asi1024 self-assigned this Apr 8, 2025
@asi1024 asi1024 added cat:test Test code / CI to-be-backported Pull-requests to be backported to stable branch prio:high labels Apr 8, 2025
@asi1024 asi1024 added this to the v14.0.0a2 milestone Apr 8, 2025
@asi1024 asi1024 merged commit e36d649 into cupy:main Apr 8, 2025
chainer-ci pushed a commit to chainer-ci/cupy that referenced this pull request Apr 8, 2025
Do `gc.collect()` in MemoryHook test code to avoid `free` hook to happen
@kmaehashi kmaehashi deleted the fix-memory-hook-tests branch April 8, 2025 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:test Test code / CI prio:high to-be-backported Pull-requests to be backported to stable branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange failure in DebugPrint test

2 participants