# How to merge variables without using additional space?

**URL:** <https://discuss.pytorch.org/t/how-to-merge-variables-without-using-additional-space/187673>\
**Category:** vision\
**Created:** [September 4, 2023, 7:56am UTC](https://discuss.pytorch.org/t/how-to-merge-variables-without-using-additional-space/187673 "2023-09-04T07:56:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BearBiscuit05](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/bearbiscuit05/32/60833_2.png) [@BearBiscuit05](https://discuss.pytorch.org/u/BearBiscuit05)\
**Post date:** [September 4, 2023, 7:56am UTC](https://discuss.pytorch.org/t/how-to-merge-variables-without-using-additional-space/187673/1 "2023-09-04T07:56:54Z")

</div>

I currently have two feature files, each with a size of 3GB, and an 8GB machine. Now, I want to load both files into memory one after the other and merge them into a single variable. I would like to know how to do this without exceeding the available memory. I tried using `torch.cat` , but it seems that the `cat` function might allocate additional memory for merging, which leads to memory overflow.
