# Safely use unsafe \`pointer\` usages

**URL:** <https://discourse.julialang.org/t/safely-use-unsafe-pointer-usages/6813>\
**Category:** General Usage\
**Tags:** memory-allocation\
**Created:** [October 31, 2017, 8:22pm UTC](https://discourse.julialang.org/t/safely-use-unsafe-pointer-usages/6813 "2017-10-31T20:22:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![goretkin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goretkin/32/167_2.png) [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Post date:** [October 31, 2017, 8:22pm UTC](https://discourse.julialang.org/t/safely-use-unsafe-pointer-usages/6813/1 "2017-10-31T20:22:14Z")

</div>

Is there any way to be safe with respect to GC unallocating objects from under you in 0.6 when constructing a pointer that lives longer than just a `ccall`?

For example, is there any way to make the equivalent in 0.6 [https://github.com/JuliaLang/julia/blob/15ca594696b5823a9f7b7c32dad6b75b0699e320/base/linalg/blas.jl#L316](https://github.com/JuliaLang/julia/blob/15ca594696b5823a9f7b7c32dad6b75b0699e320/base/linalg/blas.jl#L316) more safe? In 0.7.0, the answer is to use [https://docs.julialang.org/en/latest/devdocs/llvm/#Keeping-values-alive-in-the-absence-of-uses-1](https://docs.julialang.org/en/latest/devdocs/llvm/#Keeping-values-alive-in-the-absence-of-uses-1) . What about for 0.6?

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [October 31, 2017, 8:33pm UTC](https://discourse.julialang.org/t/safely-use-unsafe-pointer-usages/6813/2 "2017-10-31T20:33:48Z")

</div>

> [@goretkin](#):
>
> is there any way to make the equivalent in 0.6

No.
