Can Extension FREE memory that application created? | developer.brewmp.com Can Extension FREE memory that application created? | developer.brewmp.com

Developer

Can Extension FREE memory that application created?

Forums:

the application malloc a memory block, and pass it to the extension. when the extension used it over, can it directly FREE the memory block?

and the another scene, the extension MALLOC a memory block, and pass it to the application. when the application don't need it , can it directly FREE the memory block?

thanks.

Yes both is possible.
But i generally follow this rule.
1)if application allocate memory and give it to other extension, then application should release the memory.
Usually extension should copy content of this memoty to its own memory, and release own memory.
2)if extension gives memory to application, then its application should release this memory after using it. Bcos, extension can't release this memory unless application tells the extension that it doest not require this memory any further more.

Yes both is possible.
But i generally follow this rule.
1)if application allocate memory and give it to other extension, then application should release the memory.
Usually extension should copy content of this memoty to its own memory, and release own memory.
2)if extension gives memory to application, then its application should release this memory after using it. Bcos, extension can't release this memory unless application tells the extension that it doest not require this memory any further more.

I have tried it.and just it works as what nileshbhanderi said.
thanks

I have tried it.and just it works as what nileshbhanderi said.
thanks