# Deeper understanding of VTK exporter’s SetStartWriteArgDelete

**URL:** <https://discourse.vtk.org/t/deeper-understanding-of-vtk-exporter-s-setstartwriteargdelete/13936>\
**Category:** Development\
**Created:** [May 26, 2024, 1:05am UTC](https://discourse.vtk.org/t/deeper-understanding-of-vtk-exporter-s-setstartwriteargdelete/13936 "2024-05-26T01:05:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Yue](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicholas_yue/32/3751_2.png) [@Nicholas\_Yue](https://discourse.vtk.org/u/Nicholas_Yue)\
**Post date:** [May 26, 2024, 1:05am UTC](https://discourse.vtk.org/t/deeper-understanding-of-vtk-exporter-s-setstartwriteargdelete/13936/1 "2024-05-26T01:05:43Z")

</div>

I am considering writing a custom exporter and was hoping to better understand the method SetStartWriteArgDelete()

Where can I find more design rationale information about the method?

Cheers

---

<div class="post-metadata">

**Author:** ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)\
**Post date:** [May 27, 2024, 8:03am UTC](https://discourse.vtk.org/t/deeper-understanding-of-vtk-exporter-s-setstartwriteargdelete/13936/2 "2024-05-27T08:03:39Z")

</div>

vtkExporter just do:

```auto
  if (this->StartWrite)
  {
    (*this->StartWrite)(this->StartWriteArg);
  }
  this->WriteData();
  if (this->EndWrite)
  {
    (*this->EndWrite)(this->EndWriteArg);
  }

```

But then someone realized the these method could allocate data and then leaks so they added the “Delete” version that are called in the destructor:

```auto
  if ((this->StartWriteArg) && (this->StartWriteArgDelete))
  {
    (*this->StartWriteArgDelete)(this->StartWriteArg);
  }
  if ((this->EndWriteArg) && (this->EndWriteArgDelete))
  {
    (*this->EndWriteArgDelete)(this->EndWriteArg);
  }

```

This is completely unused in VTK and since this was added in **1998** , should be deprecated and removed imo, unless you see a usecase where it matters.
