in reply to Reading memory of a different process

No, in general, it's not possible, because the memory address belongs to memory that does not belong to the current process (perl) and thus is not readable for Perl. You can try to get at a pointer to any arbitrary memory adress via Devel::Peek or Pointer, but the operating system will not let you see the memory of the other program, especially when the other program is not running anymore.

  • Comment on Re: Reading memory of a different process

Replies are listed 'Best First'.
Re^2: Reading memory of a different process
by opensourcer (Monk) on Jan 31, 2005 at 13:56 UTC
    is it possible if im running a c code witin perl file

      No, most likely not. You don't seem to understand how memory is allocated by modern operating systems - normally, no process (=program, for our purposes) is allowed to read the memory section of any other program, unless the other program explicitly opens up some memory to be read by other programs. So even if you start another program as a subprogram, you are unlikely to be allowed by your OS to read it. Also, at least with reasonably modern operating systems, memory addresses should be reused and should be local to every process, but I think that at least on the x86 platform, all 32-bit operating systems hand out a shared address space to all processes (but still with read/write protection).

      If the program has stopped running already (like your C program after it prints the memory address), the memory of the program will be overwritten by other programs as the operating system gives the memory to other programs.

      In any case, Perl is most likely not the tool you want to be using, whatever you want to do.