Context : Hydrogenated amorphous carbon ( a-C : H ) has been proposed as one of the carbonaceous solids detected in the interstellar medium . Energetic processing of the a-C : H particles leads to the dissociation of the C-H bonds and the formation of hydrogen molecules and small hydrocarbons . Photo-produced H _ { 2 } molecules in the bulk of the dust particles can diffuse out to the gas phase and contribute to the total H _ { 2 } abundance . Aims : We have simulated this process in the laboratory with plasma-produced a-C : H and a-C : D analogs under astrophysically relevant conditions to investigate the dependence of the diffusion as a function of temperature . Methods : Experimental simulations were performed in a high-vacuum chamber , with complementary experiments carried out in an ultra-high-vacuum chamber . Plasma-produced a-C : H analogs were UV-irradiated using a microwave-discharged hydrogen flow lamp . Molecules diffusing to the gas-phase were detected by a quadrupole mass spectrometer , providing a measurement of the outgoing H _ { 2 } or D _ { 2 } flux . By comparing the experimental measurements with the expected flux from a one-dimensional diffusion model , a diffusion coefficient D could be derived for experiments carried out at different temperatures . Results : Dependance on the diffusion coefficient D with the temperature followed an Arrhenius-type equation . The activation energy for the diffusion process was estimated ( E _ { D } ( H _ { 2 } ) = 1660 \pm 110 K , E _ { D } ( D _ { 2 } ) = 2090 \pm 90 K ) , as well as the pre-exponential factor ( D _ { 0 } ( H _ { 2 } ) = 0.0007 ^ { +0.0013 } _ { -0.0004 } cm ^ { 2 } s ^ { -1 } , D _ { 0 } ( D _ { 2 } ) = 0.0045 ^ { +0.005 } _ { -0.0023 } cm ^ { 2 } s ^ { -1 } ) Conclusions : The strong decrease of the diffusion coefficient at low dust particle temperatures exponentially increases the diffusion times in astrophysical environments . Therefore , transient dust heating by cosmic rays needs to be invoked for the release of the photo-produced H _ { 2 } molecules in cold PDR regions , where destruction of the aliphatic component in hydrogenated amorphous carbons most probably takes place .