# memory access error in vtkrenderwindow-\>render procedure

**URL:** https://discourse.vtk.org/t/memory-access-error-in-vtkrenderwindow-render-procedure/14381
**Category:** Development
**Tags:** code
**Created:** [August 9, 2024, 4:14pm UTC](https://discourse.vtk.org/t/memory-access-error-in-vtkrenderwindow-render-procedure/14381 "2024-08-09T16:14:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![grant](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/a5b964/32.png) [@grant](https://discourse.vtk.org/u/grant)
#### Post date: [August 9, 2024, 4:14pm UTC](https://discourse.vtk.org/t/memory-access-error-in-vtkrenderwindow-render-procedure/14381/1 "2024-08-09T16:14:49Z")

</div>

Hello,

I am trying to render 58M cylinders, but it seems to have an access error during the vtkrenderwindow-\>render procedure. It produces the window and begins to render and at some point has a memory access error. After this time it throws the exception on the first access of memory after that command and the render window never shows up. I have begun seeing the error larger than 22M elements (I tried smaller versions of the same dataset).

I have also cut the dataset in half and rendered each half successfully, so I know it is not the input dataset.

I have traced the problem entirely to this function, none of the rest of the code throws an error. Also, it does not matter if I put all the cylinders in a single actor or multiple actors.

Thanks for any help!

Grant

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [August 9, 2024, 4:18pm UTC](https://discourse.vtk.org/t/memory-access-error-in-vtkrenderwindow-render-procedure/14381/2 "2024-08-09T16:18:33Z")

</div>

> [@grant](#):
>
> Also, it does not matter if I put all the cylinders in a single actor or multiple actors.

Have you tried grouping all cylinders using the `vtkGroupDataSetsFilter` and using a `vtkCompositePolyDataMapper` with a single actor?

---

<div class="post-metadata">

### Author: ![grant](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/a5b964/32.png) [@grant](https://discourse.vtk.org/u/grant)
#### Post date: [August 11, 2024, 12:03pm UTC](https://discourse.vtk.org/t/memory-access-error-in-vtkrenderwindow-render-procedure/14381/3 "2024-08-11T12:03:56Z")

</div>

1. I’m not sure how using a different data filter will help the rendering bug with memory access, would that be a difference in internal rendering that somehow is better at handling internal object memory?
2. I am using the last release (8.2) which doesn’t have vtkGroupDataSetsFilter. Is there any alternative fix that doesn’t involve the arduous process of re-building VTK and my project using my current release?

Thanks for the help in advance!

Grant

---

<div class="post-metadata">

### Author: ![grant](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/a5b964/32.png) [@grant](https://discourse.vtk.org/u/grant)
#### Post date: [August 11, 2024, 2:54pm UTC](https://discourse.vtk.org/t/memory-access-error-in-vtkrenderwindow-render-procedure/14381/4 "2024-08-11T14:54:40Z")

</div>

If it helps, here is the error: Exception thrown at 0x00007FFC836463B7 (vtkRenderingOpenGL2-8.2.dll) in grantCylinderViewer.exe: 0xC0000005: Access violation writing location 0x0000020A5EAF1000.

More information:  
I am storing each cylinder in a vtkCellArray (for the endpoints and the connections). I thin convert to a vtkPolyData by setting the points and connections and the point data of radii and color. Because of internal errors I could not previously debug, each cylinder has unique endpoints, so the points are duplicated as many times as need be. This was then piped into a vtkTubeFilter, then piped to a vtkPolyDataMapper and finally to a vtkActor before sending to the renderer and renderwindow.

---

<div class="post-metadata">

### Author: ![grant](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/a5b964/32.png) [@grant](https://discourse.vtk.org/u/grant)
#### Post date: [August 12, 2024, 1:36pm UTC](https://discourse.vtk.org/t/memory-access-error-in-vtkrenderwindow-render-procedure/14381/5 "2024-08-12T13:36:04Z")

</div>

Okay so after a lot of playing around I found a workaround. I use cell data for coloration instead of point data and reduce the number of sides of the tubefilter from 8 to 4 (resolution is not a big deal for this many vessels). now I am seeing how it scales, but so far it has gone up to 28M vessels without a problem
