Skip to content

Replace finalizer() with finalization queues #34

@muellren

Description

@muellren

Off-heap memory allocated by DeviceArray objects are freed in the finalizer, i.e., cudaFree(...) is called in the objects finalize() method.

As finalize() is deprecated since Java 9, resource deallocation should be implemented using finalization queues.

The finalizer queue should be checked at certain points throughout the lifetime of the language context and memory buffers on the queue freed up with cudaFree(). The cleanup must be performed by the proper thread. Given grCUDA is registered as single-threaded language in Truffle, the deallocation must be performed by the main thread.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions