cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How can the Web.Link caller do the ProArrayFree() for memory allocated by ProTkdllFunction callee

Highlighted
Garnet

How can the Web.Link caller do the ProArrayFree() for memory allocated by ProTkdllFunction callee

ProArray allocated in the ProTkdllFunction like this:

    status = ProArrayAlloc(1, sizeof(ProArgument), 1, (ProArray*)outputs);

for the function's output arguments. These output arguments need to be free'ed once after being used. 

The question is: How can the Web.Link caller do the ProArrayFree() or ProArgumentProarrayFree()? 

Tags (2)
3 REPLIES 3
Highlighted

Re: How can the Web.Link caller do the ProArrayFree() for memory allocated by ProTkdllFunction calle

If I understand your question correctly....

 

You should be able to just use normal javascript operations - like re-initialize it to an empty array.

 

// init with values

var myArr = [1,2,3,4,5];

 

// to clear it...

var myArr = [];

 

Dave

Highlighted

Re: How can the Web.Link caller do the ProArrayFree() for memory allocated by ProTkdllFunction calle

That memory is allocated in ToolKit C language code and return the reference to JavaScript as an output object. I think to redirect the object token to an empty array would not release that allocated memory. But I don't know how to call the official ToolKit C language function, ProArrayFree(), from Web.Link JavaScript side, not even know anything about the input arguments it needs.

 

If the suggestion is actually on the correct direction, we probably can try to 'delete' that returned object? Delete it and its destructor  magically do the right things to call ToolKit to release the memory? 

Highlighted

Re: How can the Web.Link caller do the ProArrayFree() for memory allocated by ProTkdllFunction calle

Looks like no needed to free the array.

I saved pointer to the array in to global variable and was try to free it at user_terminate() function. But memory was changed before and I got PRO_TK_BAD_INPUTS.

Announcements