Welcome! Log In Create A New Profile

Advanced

Freeing Structures

Posted by Victor Hernandez.pcs.crosspost 
Victor Hernandez.pcs.crosspost
Freeing Structures
May 06, 2009 08:37AM
Hi
Ive declared structures within Project Code, and im using them in classes
declaring them Globally for the class.
When i use a class i use the following syntax

lcl_class is object dynamic = new class_test
lcl_class = new class_test

and im having trouble with the structure that im using inside the class, it seems the values from the structure dont reset after the event in which the class is declared exits, i tried using:
delete lcl_class
To free the memory from the objects so the values from the structure reset but it didnt work, and i tried to delete the structure before the event exits but it throws a warning: Unable to free non-dynamic object.
What am i doing wrong

Message forwarded from pcsoft.us.windev
BLS
Re: Freeing Structures
May 06, 2009 02:19PM
HI Victor,
your code looks a bit wrong :

lcl_class is object dynamic = new class_test
lcl_class = new class_test

the first line is already enough.

Next, you talk about structures ,,, in case that you want to delete (free) a structure you have to declare them as follows :
// Global structure
st is structure
v is int
end

within your class you can write something like this :
PRIVATE :
myStruct is st dynamic
// Constructor
myStruc = New st
// Destructor
Free myStruct

HTH, Björn



Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: