Board index » delphi » Invalid pointer operation???!!!

Invalid pointer operation???!!!

Hi,
I'm having a problem with the DISPOSE function in that when I pass it
a pointer to the data I want to deallocate memory for it says "Invalid
pointer operation". BTW, I am passing it a pointer to a node in a linked
list. 2 possibilities are:1) The pointer is pointing to NIL which isn't
the case since I put a watch on the variable and it doesn't point to NIL,
2) The pointer points outside the heap, which I think is the problem. Can
any1 tell me how to solve this problem?
Thanx in advance,  

********************************************************************            
Stephen W Franken      
4th year Bachelor of Electrical and Computer Engineering                              
Queensland University of Technology,
Gardens Point, Brisbane, QLD, AUSTRALIA                                                            
Email: s.fran...@student.qut.edu.au                                
********************************************************************

 

Re:Invalid pointer operation???!!!


Quote
STEPHEN FRANKEN wrote:

> Hi,
> I'm having a problem with the DISPOSE function in that when I pass it
> a pointer to the data I want to deallocate memory for it says "Invalid
> pointer operation". BTW, I am passing it a pointer to a node in a linked
> list. 2 possibilities are:1) The pointer is pointing to NIL which isn't
> the case since I put a watch on the variable and it doesn't point to NIL,
> 2) The pointer points outside the heap, which I think is the problem. Can
> any1 tell me how to solve this problem?
> Thanx in advance,

Did you initialize all pointers to NIL before starting the main part
of your program? And please beware: when running the program from the
IDE (i.e. debugging it in the IDE with all debug-information activated)
all variables _are_ initiliazed by BP/TP! But when running it on its
own (or without debug information, I think) all variables are
initialized with random values. This is at least my experience.

Hope this helps.

Bernd Heutling

Re:Invalid pointer operation???!!!


In article <3535EB86.3...@mbox.ikph.uni-hannover.de>,
Bernd Heutling  <Heutl...@mbox.ikph.uni-hannover.de> wrote:

Quote

>Did you initialize all pointers to NIL before starting the main part
>of your program? And please beware: when running the program from the
>IDE (i.e. debugging it in the IDE with all debug-information activated)
>all variables _are_ initiliazed by BP/TP! But when running it on its
>own (or without debug information, I think) all variables are
>initialized with random values. This is at least my experience.

At least version 7.0 clears the entire data segment at the beginning.

Osmo

Re:Invalid pointer operation???!!!


3rd possibiltie is that the pointer has already been disposed.  If you are
using OOP to implement the linked list. it's possible that you are disposing of
heap memory that has already been deallocated by another method.

Other Threads