# Is cudaMallocmanaged with cudaMemAttachHost  flag is faster than malloc?

**URL:** <https://forums.developer.nvidia.com/t/is-cudamallocmanaged-with-cudamemattachhost-flag-is-faster-than-malloc/41261>\
**Category:** Jetson TK1\
**Created:** [February 4, 2016, 7:58am UTC](https://forums.developer.nvidia.com/t/is-cudamallocmanaged-with-cudamemattachhost-flag-is-faster-than-malloc/41261 "2016-02-04T07:58:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SRK\_bharadwaj](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@SRK\_bharadwaj](https://forums.developer.nvidia.com/u/SRK_bharadwaj)\
**Post date:** [February 4, 2016, 7:58am UTC](https://forums.developer.nvidia.com/t/is-cudamallocmanaged-with-cudamemattachhost-flag-is-faster-than-malloc/41261/1 "2016-02-04T07:58:14Z")

</div>

Hi,  
I am devoloping an application on Jetson Tk1. I have created an array using cudaMallocmanaged with cudaMemAttachHost flag. If I use that array in computation, It is faster compared if use an array allocated with normal malloc. I am wondering what could be the reason behavior. Please some one help me to understand this.

Thanks  
sivaramakrishna

---

<div class="post-metadata">

**Author:** ![kayccc](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kayccc/32/14043_2.png) [@kayccc](https://forums.developer.nvidia.com/u/kayccc)\
**Post date:** [February 15, 2016, 8:48am UTC](https://forums.developer.nvidia.com/t/is-cudamallocmanaged-with-cudamemattachhost-flag-is-faster-than-malloc/41261/2 "2016-02-15T08:48:23Z")

</div>

Hi sivaramakrishna,

Not sure what’s your use case, but since the cudaMallocmanaged is page-locked, it’s as opposed to regular pageable host memory allocated by malloc(), to use page-locked host memory has several benefits, you could refer to [url][http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#page-locked-host-memory[/url]](http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#page-locked-host-memory%5B/url%5D)

Thanks
