<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Deleting Objects in v15 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/235907#M46530</link>
    <description>&lt;P&gt;Thanks everyone, I think the evidence if clear that reassigning an object variable destroys the object rather than leaving it as an orphan in memory,&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2019 10:14:05 GMT</pubDate>
    <dc:creator>David_Burnham</dc:creator>
    <dc:date>2019-11-21T10:14:05Z</dc:date>
    <item>
      <title>Deleting Objects in v15</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234167#M46440</link>
      <description>&lt;P&gt;In JSL I can define a class and use it as a template to instantiate objects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I delete the object?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been using the message deleteClass, assuming its a slight misnomer and really it's deleting the object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But in version 15 it really does seem to delete the class.&amp;nbsp; Once I use the message I'm unable to create any further instances of the class.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can use a delete message but I think its just an alias for deleteClass and I have the same problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is delete class really intended to wipe out the entire class definition?&amp;nbsp; If so, what is the correct way of deleting the object?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a simple test script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

defineClass("MyClass",{
	_value = .,
	_init_ = method({value},
		_value = value;
	),
	getValue = method({},
		return(_value)
	)
});

// this works
obj = newObject( MyClass( 10 ) );
show(obj:getvalue);

// this works 
obj = newObject( MyClass( 20 ) );
show(obj:getvalue);

// there should be no harm deleting
// an object once I am finished with it
obj&amp;lt;&amp;lt;delete;

// but this now fails ...
obj = newObject( MyClass( 30 ) );
show(obj:getvalue);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 19:03:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234167#M46440</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2019-11-18T19:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Objects in v15</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234191#M46443</link>
      <description>&lt;P&gt;Does this work: obj = .;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:24:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234191#M46443</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-11-18T20:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Objects in v15</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234192#M46444</link>
      <description>&lt;P&gt;I don't know.&lt;/P&gt;
&lt;P&gt;Before it was possible to "define classes" I created them using namespaces.&lt;/P&gt;
&lt;P&gt;For namespaces this doesn't work i.e. setting the variable to missing is not the same as deleting the namespace.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ns = newNamespace("xyz");
ns:a = 10;

ns = .;

show namespaces();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:37:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234192#M46444</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2019-11-18T20:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Objects in v15</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234252#M46455</link>
      <description>&lt;P&gt;I don't understand how to use it either. I think you don't need it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Define Class(
	"aa",
	{_init_ = Method( {a}, this:b = a ), //
	x=1, //
	m1 = Method( {a, b}, a * b )}
);

// 
lcaa42 = New Object( aa(42) );

lcaa42:x= Run Program(//
		Executable( "PING.EXE" ), //
		Options( {"-n 50", "localhost"} ), //
		ReadFunction(
			Function( {this},
				write(this &amp;lt;&amp;lt; read);
			)
		)
	);
	
wait(5); // report about 5 of the 50 pings to the log

// this will destroy the old object and replace it with a
// new one. The log will report the RunProgram object was
// destroyed; there may be a more clever way to witness the
// destruction...best I could come up with...
lcaa42 = New Object( aa(42.1) ); // the old one is gone
lcaa43 = New Object( aa(43) ); // the class still works
show(lcaa42:b,lcaa43:b); // 42.1,43
Show Classes();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Pinging v1-PC [::1] with 32 bytes of data:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Reply from ::1: time&amp;lt;1ms &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Reply from ::1: time&amp;lt;1ms &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Reply from ::1: time&amp;lt;1ms &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Reply from ::1: time&amp;lt;1ms &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Reply from ::1: time&amp;lt;1ms &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Reply from ::1: time&amp;lt;1ms &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;The external program was producing output when the RunProgram object was destroyed.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Use a JSL variable to hold the RunProgram object.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Optionally, send messages to the variable to manage the object's lifetime.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;lcaa42:b = 42.1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;lcaa43:b = 43;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;// Class aa&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_init_ = Method( {a}, this:b = a );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;m1 = Method( {a, b}, a * b );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;x = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This shows the first object was deleted by assigning a new value to the variable holding it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If other variables are copied (not cloned)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;lcaa42b=lcaa42;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then all the copies must be cleared to destroy the object.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;lcaa42b=0;
lcaa42=0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11257"&gt;@EvanMcCorkle&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 01:01:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/234252#M46455</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-11-19T01:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Objects in v15</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/235531#M46482</link>
      <description>&lt;P&gt;It seems like it's overwriting it if you just overwrite the variable.&amp;nbsp; I ran&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Define Class(
	"Test",
	nObs = 20;
	addition = Method( {x, y},
		(x + y) * nObs
	);
	append = Method( {a, b},
		Char( a ) || " + " || Char( b )
	);
);

for(i=1, i&amp;lt;=1000000, i++, 
	clref = New Object( Test() );
);

delete symbols(clref);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;While looking at the memory usage of JMP and it didn't really move.&amp;nbsp; I would expect if it wasn't actually overwriting it I'd see memory go up if I have a million of them.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:18:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/235531#M46482</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2019-11-19T20:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Objects in v15</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/235907#M46530</link>
      <description>&lt;P&gt;Thanks everyone, I think the evidence if clear that reassigning an object variable destroys the object rather than leaving it as an orphan in memory,&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 10:14:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Objects-in-v15/m-p/235907#M46530</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2019-11-21T10:14:05Z</dc:date>
    </item>
  </channel>
</rss>

