Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display register memory locations

Status
Not open for further replies.

vsunh

Programmer
Aug 23, 2003
52
AE
Is there any command in Unix or C by which, we can list/ display all available memory locations (CPU ragister memory addresses) on the system & check which ones are used or free.

We are using ScoUnix 7.1.1 system.
 
We have many programs running on our system in which we dedicate memory addresses for different variables e.g # define var1 7000, #define var2 7200 etc

we want to list all memory locations in the system & see which one is allocated & which ones are free?

any help?
 
How come you have absolute memory addresses in a Unix system?

> we want to list all memory locations in the system & see which one is allocated & which ones are free?
'grep' for the #defines which specify your addresses, then 'sort' by the value. If you have anything like a half decent naming convention for these variables, they shouldn't be too hard to find.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
many thanks but is this the only way? This will only grep the #define string?

i do not want that, i want to list all memory addresses on the system

If any way possible pls let me know?
 
vsunh said:
We have many programs running on our system in which we dedicate memory addresses for different variables e.g # define var1 7000, #define var2 7200 etc
Are you doing that to share data between programs? If that's why you're doing it, there are better and safer ways to share memory. I've never used these functions myself, but I saw them used in a project I was on... Check out these functions: shmat(), shmdt(), shmget(), shmctl()...
 
> many thanks but is this the only way?
Probably not, but in the absence of more detailed information from you, I'm not going to make guesses.

> This will only grep the #define string?
Isn't that enough, or do you also have other ways of accessing this memory, with say 'var1+10' elsewhere in the code?

Rewrite the programs to use structures and the 'shm' functions cpjust mentioned. Then you'd have much better control over what is going on.

--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top