# Does shallow copy increase the lifetime of an object?

**URL:** https://discourse.vtk.org/t/does-shallow-copy-increase-the-lifetime-of-an-object/14974
**Category:** Development
**Created:** [December 6, 2024, 9:48am UTC](https://discourse.vtk.org/t/does-shallow-copy-increase-the-lifetime-of-an-object/14974 "2024-12-06T09:48:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![joint](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.vtk.org/u/joint)
#### Post date: [December 6, 2024, 9:48am UTC](https://discourse.vtk.org/t/does-shallow-copy-increase-the-lifetime-of-an-object/14974/1 "2024-12-06T09:48:45Z")

</div>

Hello!

Let s say, I have a filter which is called in a function and is desctructed then the function returns.

The function also shallow-copies the filter output to the object of the caller scope.

The question is, whether the filter output data could actually be invalidated when the filter object is destroyed?

Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [December 8, 2024, 2:22am UTC](https://discourse.vtk.org/t/does-shallow-copy-increase-the-lifetime-of-an-object/14974/2 "2024-12-08T02:22:49Z")

</div>

Yes, the output object of the folder will be deleted when the filter is deleted if no other object references it. A copy operation does not increase the reference count of the source object.
