mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 05:30:11 +01:00
gallivm: orcjit: keep the ownership of tm for LPJit
The ownership of the TargetMachine object is released when LPJit singleton is constructed, leads to a slight memory loss detectable. Keep the ownership by saving the unique pointer as another class member named tm_unique. Signed-off-by: Icenowy Zheng <uwu@icenowy.me> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30216>
This commit is contained in:
parent
dc6e6d7a2b
commit
3423e73cec
1 changed files with 3 additions and 1 deletions
|
|
@ -279,6 +279,7 @@ private:
|
|||
static LPJit* jit;
|
||||
|
||||
std::unique_ptr<llvm::orc::LLJIT> lljit;
|
||||
std::unique_ptr<llvm::TargetMachine> tm_unique;
|
||||
/* avoid name conflict */
|
||||
unsigned jit_dylib_count;
|
||||
|
||||
|
|
@ -318,7 +319,8 @@ LPJit::LPJit() :jit_dylib_count(0) {
|
|||
|
||||
init_native_targets();
|
||||
JITTargetMachineBuilder JTMB = create_jtdb();
|
||||
tm = wrap(ExitOnErr(JTMB.createTargetMachine()).release());
|
||||
tm_unique = ExitOnErr(JTMB.createTargetMachine());
|
||||
tm = wrap(tm_unique.get());
|
||||
|
||||
/* Create an LLJIT instance with an ObjectLinkingLayer (JITLINK)
|
||||
* or RuntimeDyld as the base layer.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue