# Python 3.8 RAM owerflow and loading issues

**URL:** <https://forums.developer.nvidia.com/t/python-3-8-ram-owerflow-and-loading-issues/147629>\
**Category:** Jetson Nano\
**Tags:** pytorch, cuda\
**Created:** [August 20, 2020, 7:40am UTC](https://forums.developer.nvidia.com/t/python-3-8-ram-owerflow-and-loading-issues/147629 "2020-08-20T07:40:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [August 20, 2020, 8:27am UTC](https://forums.developer.nvidia.com/t/python-3-8-ram-owerflow-and-loading-issues/147629/3 "2020-08-20T08:27:03Z")

</div>

Hi,

It looks like you are facing some issue related to the CUDA context.  
In general, you should store/restore the CUDA context when switching the tasks for each thread.

A sample for CUDA with thread can be found here:

> [@How to use TensorRT by the multi-threading package of python](https://forums.developer.nvidia.com/t/how-to-use-tensorrt-by-the-multi-threading-package-of-python/123085/8):
>
> Hi, The sample is ready. The workflow looks like this: Master: create TensorRT engine and buffer, store the created CUDA context. Thread1: restore master’s CUDA context, run inference, destroy its CUDA context. Master: destroy the stored CUDA context. The sample is created with TensorRT default MNIST model. 1. Prepare data $ /usr/src/tensorrt/bin/trtexec --onnx=/usr/src/tensorrt/data/mnist/mnist.onnx --saveEngine=mnist.trt $ cd /usr/src/tensorrt/data/mnist/ $ sudo pip3 install pillow $ pyt…

Please let me know if I misunderstood your question.  
Thanks.

---

_[View the full topic](https://forums.developer.nvidia.com/t/python-3-8-ram-owerflow-and-loading-issues/147629)._
