Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How to access the contents of a specific memory address?

by Marshall (Canon)
on Jul 29, 2012 at 23:16 UTC ( [id://984320]=note: print w/replies, xml ) Need Help??


in reply to How to access the contents of a specific memory address?

Basically the posts here not with standing:
The answer is NO.

Perl cannot access an absolute physical memory address.

In "C" there are ways to "map" a piece of physical memory to an array - maybe for memory mapped I/O?
But such a thing has to run as a kernel process (device driver, etc).

A user process like Perl simply cannot do it. Thats it.

A user process can access its own DATA space, but this is an offset from a physical address of which the user process is completely unaware - the hardware does some magic. Since Perl is a "user" process, it cannot know and it cannot access an actual physical memory address like say, "0x000" - the OS will prevent such a thing - its just that simple. NO, Absolutely NOT!

  • Comment on Re: How to access the contents of a specific memory address?

Replies are listed 'Best First'.
Re^2: How to access the contents of a specific memory address?
by BrowserUk (Patriarch) on Jul 30, 2012 at 01:16 UTC
    In "C" there are ways to "map" a piece of physical memory ... Since Perl ... cannot access an actual physical memory address.

    Sorry, but I think you are just muddying the waters with this post. The OP didn't ask how to do that.

    Nowhere in the OP did he mention "physical memory", just a specific memory address & the memory address of a given variable & a given memory address; all of which are generically taken to mean: addresses within the virtual address space of the current process unless explicitly qualified otherwise.

    Outside the auspices of deep technical discussion at the operating system or hardware level, this -- along with your other occasional overreach in to technicalities: there's no such thing as a file -- just come across as clever dickiness rather than constructive attempts to help.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      Ok. My effort failed. My intent was not to be "dicky" whatever that means. So what is the best practical "how to" answer for the OP?
        So what is the best practical "how to" answer for the OP?

        bulk88 has already given that answer in How to access the contents of a specific memory address?.

        The long and short of which is that: it is possible to obtain access to raw address values of the PV component of Perl scalars using pack 'p' & 'P'; but there is not much that you can usefully do with them once obtained. Any attempt to manipulate pointers obtained that way -- beyond reading the contents of the memory the point at -- will simply segfault.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://984320]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 23:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found