# How to debug this error when program is running?

**URL:** <https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488>\
**Category:** Development\
**Tags:** code\
**Created:** [October 15, 2023, 12:36pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488 "2023-10-15T12:36:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 15, 2023, 12:36pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/1 "2023-10-15T12:36:16Z")

</div>

```
SymGetLineFromAddr64 returned error code 487
at BaseThreadInitThunk

```

ERROR: In D:\APP\VTK-8.2.0\Rendering\OpenGL2\vtkOpenGLImageSliceMapper.cxx, line 485  
vtkOpenGLImageSliceMapper (02A30300): failed after RenderPolygon 1 OpenGL errors detected  
0 : (1286) Invalid framebuffer operation

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 15, 2023, 12:37pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/2 "2023-10-15T12:37:15Z")

</div>

![image](https://discourse.vtk.org/uploads/default/original/2X/d/db833da0b90be0b7b5e49f9fe5c331796849cf29.png)  
vtkoutputwindow message

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 16, 2023, 5:27pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/3 "2023-10-16T17:27:54Z")

</div>

Hello,

Are you using Qt? Do you have the latest graphics driver installed?

regards,

PC

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 18, 2023, 1:27pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/5 "2023-10-18T13:27:29Z")

</div>

Hello PC,  
I didn’t use QT yet.  
these info were output by vtkoutputWindow

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 18, 2023, 9:29pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/6 "2023-10-18T21:29:20Z")

</div>

> [@Paulo\_Carvalho](#):
>
> Do you have the latest graphics driver installed?

👆

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 19, 2023, 12:18pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/7 "2023-10-19T12:18:15Z")

</div>

the graphics driver on windows, you mean OpenGL?

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 19, 2023, 1:57pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/8 "2023-10-19T13:57:40Z")

</div>

Yes. The back-end libraries of the 3D graphics APIs (OpenGL, Direct3D, etc.) are provided by the vendor of your graphics card. These should be kept updated so to support all the possible operations made by the front-end (VTK making OpenGL calls in your program).

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 21, 2023, 2:38am UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/9 "2023-10-21T02:38:21Z")

</div>

I checked the graphics driver, it’s newest.

is the error code about memory leak?

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 21, 2023, 11:51am UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/10 "2023-10-21T11:51:37Z")

</div>

No. A memory leak is a silent defect that consists of a program loosing track of dynamically allocated memory (e.g. a `delete` or `free()` wasn’t executed due to an early function return or exception thrown). That memory remains unavailable and unusable until the program finishes, but it doesn’t trigger an exception.

Well, usually, the first suspect in such cases is client code. Here are the parts of the stack strace that I believe are client code:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/7/72068f3c0edc1e7bfc535fd288f2a1f75c06ee57.png)

I’d take a look at those codes, starting at the topmost one. A stack trace is presented such that the code where the exception emerged appears first. Note that it is not necessarily the root cause of the error. It may be caused by ill-written multithreaded code. It may be caused by pixel format mismatch between the OpenGL back-end and the GUI API. It may be caused by excess `Update()`s triggered by mouse events… BTW, which graphics system are you using? You said you’re not using Qt, so what? MFC? GLUT?

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 21, 2023, 1:55pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/11 "2023-10-21T13:55:45Z")

</div>

Really thanks for your reply, Paulo.

I will use Qt in the future , I haven’t integrated these vtk codes into QT yet.

You are very right , I called many update() function in MouseMove event.

Becaues I have 7 windows to display actors. And when MouseMove event happened in one window, all other window need to be updated( called `interactor->Render()` ).

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 21, 2023, 1:59pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/12 "2023-10-21T13:59:54Z")

</div>

![image](https://discourse.vtk.org/uploads/default/original/2X/7/72068f3c0edc1e7bfc535fd288f2a1f75c06ee57.png)

codes at line 28 :  
`void GLIOIREWindow::Show() { this->interactor->Start(); }`

codes line 375:

```auto
	this->Interactor->Render();
	gObject.win2DFirst->Update();
	gObject.win2DSecond->Update();

```

codes at line 90:

```auto
void GLIOIREWindow::Update()
{
	this->interactor->Render();
}

```

yeah ,It’s all about to rerender the window.

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 21, 2023, 9:36pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/13 "2023-10-21T21:36:44Z")

</div>

So, according to the stack trace, you’re basically calling `Render()` on your interactor thrice in a row, right? If so, why are you doing that? Wich class does `this->interactor` belong to?

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 23, 2023, 12:58pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/14 "2023-10-23T12:58:16Z")

</div>

I have many windows. when I do some mouse action at one window, I need to render other windows to update the actors’s status. that’s why I called Render() in high-frequency.

`GLIOIREWindow` class was created by myself , it contains many components like vtkRenderWindow / vtkInteractor and so on…

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 23, 2023, 5:24pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/15 "2023-10-23T17:24:52Z")

</div>

> [@Paulo\_Carvalho](#):
>
> You said you’re not using Qt, so what? MFC? GLUT?

👆

> [@Paulo\_Carvalho](#):
>
> Wich class does `GLIOIREWindow::interactor` belong to?

👆

Is it also `Win3D::Win3DInteractorStyle`?

I guess you need to thoroughly review those custom classes. Without access to their code, we’re left to guess. I believe the issue is caused by possibly spamming of mouse events resulting in overflowing OpenGL calls given the multiple view ports. Perhaps calling `WaitForCompletion()` right after calling `Render()` on your `vtkRenderWindow` objects may prevent those errors. `vtkRenderWindow::CheckInRenderStatus()` (returns an `int`) may also be used to verify whether rendering is still under way for a given `vtkRenderWindow`.

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 24, 2023, 1:24pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/16 "2023-10-24T13:24:37Z")

</div>

yeah , `Win3D::Win3DInteractorStyle` was set to `GLIOIREWindow::interactor` as follow:

```auto
void Win3D::InitInteractorStyle()
{
	this->win3DInteractorStyle->SetVolume(gObject.brainVolume);
	this->win3DInteractorStyle->SetPicker(this->GetPicker());
	this->GetInteractor()->SetInteractorStyle(this->win3DInteractorStyle);
}

```

So much thanks for the advice, I will have a try.  
thanks again.

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 24, 2023, 9:20pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/17 "2023-10-24T21:20:45Z")

</div>

Other things to try:

1. If your app renders from multiple threads, please consider dropping this. Massive parallelization already occurs in the GPU. But if you do need that, do be sure each thread has its own OpenGL context.
2. You still didn’t say which windowing system you are using. Check whether the pixel format being used in OpenGL matches the one the windowing system was configured to use.
3. Try commenting out rendering code bit-by-bit until the error ends. This may help you pinpoint the root cause of the issue.

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 25, 2023, 12:38pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/18 "2023-10-25T12:38:00Z")

</div>

Windows System: The default output window that comes with vtk  
and I will Integrate these codes into vtk in the future.

thanks for so many advice

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 25, 2023, 4:33pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/19 "2023-10-25T16:33:33Z")

</div>

> [@Dylan](#):
>
> Windows System:

Do you mean MFC?

---

<div class="post-metadata">

**Author:** ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)\
**Post date:** [October 26, 2023, 1:45pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/20 "2023-10-26T13:45:30Z")

</div>

I write vtk code in vs， and show the display window.  
is that MFC? I don’t think so.

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 26, 2023, 2:22pm UTC](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488/21 "2023-10-26T14:22:45Z")

</div>

If you’re not using Qt, I think you need to know which GUI API you are using in order to diagnose issues that are related to it.

[Next page](https://discourse.vtk.org/t/how-to-debug-this-error-when-program-is-running/12488.md?page=2)
