Did you allocate these pointers yourself?
myPointer = %Alloc( SIZE );
Then you should deallocate them.
Adding the (N) option will set your pointer to null when you deallocate.
Dealloc(N) myPointer;
However, it sounds like you talking about pointers you get from yajl.
You mention using yajl_tree_free() to deallocate the data within yajl.
But then after that you are worrying about the pointers that you got out of calls to procedures like YAJL_object_find().
I'd suggest you put your code and pointer variables into a sub-procedure.
Then call yajl_tree_free() just before you exit the procedure. That way all the pointers are just gone.
You should not specifically deallocate a pointer that was returned by any YAJL procedure. That's for Yajl to do when you call the procedure yajl_tree_free().
After you call yajl_tree_free() you should never use any pointer you got out of yajl. The pointer most likely now points to deallocated memory.
If you are working with Global pointers and just want them to stop pointing at something, then just clear them after you run yajl_tree_free() .
Nodepointer = yajl_stmf_load_tree();
...
yajl_tree_free(nodepointer)
Clear myPointer;
Clear myPointer2;
Clear myPointer3;
Defining a pointer just to INZ it to *Null is a waste of 16 bytes of memory.
Especially since the *NULL built-constant is there.
And it's a waste of time. If you want the pointer to be empty why waste time checking if it has a value? Just clear it.
When parsing json with yajl, the only pointer that you need to keep track of is the one you get from yajl_stmf_load_tree(), and that's the one that is passed to yajl_tree_free() for cleanup.
All the other pointers can just be cleared. You don't specifically deallocate those because you did not allocate them.
If it was me, I'd just have the pointers inside a sub procedure, and then return from that procedure when my processing with yajl was done.
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Dave
Sent: Friday, July 23, 2021 3:05 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Pointer Reset operation?
Yes I'm using yajl_tree_free() but this makes no difference to the
pointers in my program. I'm guessing this just frees the memory used by
the
*srvpgm
As an Amazon Associate we earn from qualifying purchases.