Re: [BLACKBOX] user input (was limiting integer values in interactor field)

From: [at]} <Robert>
Date: Sat, 16 Jan 2010 22:45:30 +0000

----boundary-LibPST-iamunique-1675084911_-_-
Content-type: text/plain

On 16/01/2010 18:38, Gunnar Bernhardt wrote:
> {([at]})nowhere.xy
> The line "self := NIL" was meant to free the memory which the action
> record consumes as soon as it is no longer needed. Wouldn't you
> recommended that?

In my own code (I accidently omitted this from the fragment I posted) the
Action record is declared globally, and NEW is called only one in
the Module's BEGIN section. This approach saves a (*very small*) amount of
processing.

The other approach is to declare the record in the Notify procedure
and call NEW for every key press, which saves a (*very small*) amount of
memory.

I do not recommend one approach over the other.

My point is that since 'self' is a (*copy*) of the pointer to the Action
record setting it to NIL has no effect; the main pointer also needs to be
cleared.

Your code might do something if the signature was:

PROCEDURE ( VAR self: attNotifierAction ) Do-

rather than

PROCEDURE ( self: attNotifierAction ) Do-.


What (I think) you need to do to free the memory it is put the line
   attActionObj := NIL
at the end of
PROCEDURE attNotifier*( n, op, from, to: INTEGER ).


Do you have a reason to export "attActionObj" ?

If not, I think its is better to move the declaration
VAR
   attActionObj : attNotifierAction;
into
PROCEDURE attNotifier*( n, op, from, to: INTEGER ).

Then there is no need to write
"attActionObj := NIL" at the end
as the garbage collector will free the memory anyway.


Cheers

Robert


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1675084911_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnR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BvcCwgZnJv
bSwgdG86IElOVEVHRVIgKS5ccGFyDQpccGFyDQpUaGVuIHRoZXJlIGlzIG5vIG5lZWQgdG8gd3Jp
dGVccGFyDQoiYXR0QWN0aW9uT2JqICA6PSAgTklMIiBhdCB0aGUgZW5kXHBhcg0KYXMgdGhlIGdh
cmJhZ2UgY29sbGVjdG9yIHdpbGwgZnJlZSB0aGUgbWVtb3J5IGFueXdheS5ccGFyDQpccGFyDQpc
cGFyDQpDaGVlcnNccGFyDQpccGFyDQpSb2JlcnRccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0K
VG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JP
WCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIfX0AEyGQVg==
----boundary-LibPST-iamunique-1675084911_-_---
Received on Sat Jan 16 2010 - 23:45:30 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:36 UTC