Recent

Author Topic: about exit code=216  (Read 9859 times)

7vinbaby

  • Jr. Member
  • **
  • Posts: 59
  • Hi ! Bless you have a good day.
about exit code=216
« on: October 02, 2016, 07:04:48 am »
i want to ask what are the reasons of exit code 216?
7vinbaby

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: about exit code=216
« Reply #1 on: October 02, 2016, 07:09:03 am »

Thaddy

  • Hero Member
  • *****
  • Posts: 14390
  • Sensorship about opinions does not belong here.
Re: about exit code=216
« Reply #2 on: October 02, 2016, 07:09:28 am »
User manual appendix D.
-----------------------------------------
 216 General Protection fault
    The application tried to access invalid memory space. This can be caused by several problems:

        Dereferencing a nil pointer.
        Trying to access memory which is out of bounds (for example, calling move with an invalid length).
----------------------------------------

In other words, there is a huge bug in your code
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Thaddy

  • Hero Member
  • *****
  • Posts: 14390
  • Sensorship about opinions does not belong here.
Re: about exit code=216
« Reply #3 on: October 02, 2016, 07:10:06 am »
We seem to cross eachother again :)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: about exit code=216
« Reply #4 on: October 02, 2016, 07:13:47 am »
In other words, there is a huge bug in your code

That can happen if you 'play' with the memory, usually using pointer, but you do not manage the memory well.

1. You need to request memory space before you use it
2. You have to free the space if you don't need it anymore
3. If you follow #1 & #2 properly and the you get error 216, it can be you do not dereferencing the pointer correctly.

Read more about dereferencing pointer here:
http://www.freepascal.org/docs-html/ref/refse15.html
« Last Edit: October 02, 2016, 07:23:11 am by Handoko »

7vinbaby

  • Jr. Member
  • **
  • Posts: 59
  • Hi ! Bless you have a good day.
Re: about exit code=216
« Reply #5 on: October 02, 2016, 07:25:47 am »
Does the lack of initialization be the one reason?
7vinbaby

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: about exit code=216
« Reply #6 on: October 02, 2016, 07:32:59 am »
Maybe. The bug can happen on anywhere in the code. Initialize variables, objects and pointers before you use it always is a good thing to do.

7vinbaby

  • Jr. Member
  • **
  • Posts: 59
  • Hi ! Bless you have a good day.
Re: about exit code=216
« Reply #7 on: October 02, 2016, 07:35:26 am »
Maybe. The bug can happen on anywhere in the code. Initialize variables, objects and pointers before you use it always is a good thing to do.

all right.Thx
7vinbaby

Thaddy

  • Hero Member
  • *****
  • Posts: 14390
  • Sensorship about opinions does not belong here.
Re: about exit code=216
« Reply #8 on: October 02, 2016, 07:56:05 am »
Does the lack of initialization be the one reason?

Try to compile with rangechecks on: the error chould change from 216 into 210 if you try to use a virtual method from a class that has not been initialized.
This does not catch use-after-free, though, which can also cause a 216.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018