I'm trying to allocate memory dynamically in my code and release them ,I tried to use zend_mm
but I couldn't add it to php
7,I'm using php
7.4 and xampp
server , if it is impossible please tell my the Alternatives to do that.
the problem is ,I try to use rundll
to execute some c functions from dll
library ,but the rundll
doesn't return output from functions so ,I try to reserve some memory from ram and run the rundll
command by exec() php
function ,passing the address to reversed memory to function, then the function writes its output on this memory so ,I can get the output after the function ends
steps :
1- php
reserve some memory from ram .
2- php
open cmd
and run the rundll
to call c function.
3- c function writes output in reserved memory .
4- php
can got the output.
exec()
is for running shell commands, it creates a new process and doesn't use the memory of the current process.zend_mm
as I understand is a part of PHP's internals, so it's there already. PHP automatically allocates blocks of memory, in response to what your code is doing, up to the limit of yourmemory_limit
. I'm not aware of an out-of-the-box means for custom memory allocation and access. Is there no other way you can return output from your dll? Could write a wrapper for it that returns the output to PHP.