Just keep reading the same page you copied and pasted: http://www.gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
there are the examples on how to initialize the library.
In general a secure memory is locked with mlock so it can't be paged out.
The library is of course unaware of malloc calls in other places of your program, check its documentation for how to use it.