Skip to content

fix GC issue by globally rooting values#19

Closed
ericphanson wants to merge 1 commit intomainfrom
eph/fix-gc-safety
Closed

fix GC issue by globally rooting values#19
ericphanson wants to merge 1 commit intomainfrom
eph/fix-gc-safety

Conversation

@ericphanson
Copy link
Owner

in #18 I did not use UnsafeArrays correctly: I assumed the gcref field would be enough to root the arrays to Julia's GC would not free the memory, making the pointer inside the UnsafeArray invalid. However it is not; Julia can figure out we never use gcref and free the memory, as the test/test_gc.jl file shows; it fails on main.

This fixes it, but at a big performance cost with

forward pass: 1.457254 seconds (5.59 k allocations: 11.969 MiB)
bumper_yolomod(b, batch_aa; detectThresh = 0.5, overlapThresh = 0.8): 1.500037 seconds (19.29 k allocations: 12.636 MiB)

compared to ~1s without allocarrays on r3tex/ObjectDetector.jl#101

@ericphanson
Copy link
Owner Author

this is a worse solution than just doing less unsafe stuff: closing in favor of #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant