LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-06-2007, 01:33 AM   #1
saurabh.azad
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
How to Find the address where Heap begins from within the program?


We need to check whether the memory falls within the heap range before processing it. For this i need to knw the starting address of the heap. Heap end can be knwn from __curbrk i guess. We do not have access to the code where malloc was first called to allocate the memory. Any help??
 
Old 03-07-2007, 03:05 PM   #2
zWaR
Member
 
Registered: Dec 2003
Distribution: Slackware, Alpine Linux, Ubuntu, Debian
Posts: 219

Rep: Reputation: 35
Try to debug the application with ddd, if it's possible. Next thing you could try is to disassemble the application. A way to do that is with SoftIce (but i'm not sure if it works under Linux) or LDasm (which 100% runs under Linux).
 
Old 03-07-2007, 06:03 PM   #3
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
sbrk(0) gives the end of allocated memory
size <filename> gives the initial size of program segments.
 
Old 03-07-2007, 11:40 PM   #4
saurabh.azad
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thx hope it works
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find physical address of kernel virtual address kushneeraj Programming 0 10-20-2006 07:29 PM
How to find an IP address from the MAC address of a remote machine ? jitz Linux - General 3 01-03-2006 07:55 AM
"accidently deleted every program in /usr/bin that begins with the letter m*" behmjoe Linux From Scratch 1 04-15-2005 08:42 AM
Find out heap size for a PID luexiong Linux - General 1 03-29-2005 09:40 AM
find MAC ADDRESS program C ofada Programming 4 01-15-2004 01:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration