[ADMB Users] memory allocation error
John Sibert
sibert at hawaii.edu
Tue Feb 28 10:29:38 PST 2012
John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa
Visit the ADMB project http://admb-project.org/
ddd in linux is pretty intuitive. Here is how I routinely do Mollie's
steps (2) and (3):
(2) put a breakpoint in ad_exit()
scroll through the source code until you see the following code:
1167 extern "C" {
1168 void ad_boundf(int i)
1169 {
1170 /* so we can stop here */
1171 exit(i);
1172 }
1173 }
It is usually at the end of the code for int main(int argc,char *
argv[]) in an admb application. (Of course, the line numbers will be
different.)
Place your cursor on the line number for the the exit(i) line (1171 in
this example) and right click.
You should see a menu.
Press the "Set Breakpoint" button. You should see a stop sign icon over
the line number.
Move your cursor to the little DDD run menu and push the "Run" button.
If there is an ADMB error, the program will stop at the breakpoint,
(3)do a stack trace
Go to the Main DDD window and click on the "Status" drop down menu.
Click on "Backtrace"
A window will pop up with see a list of code statements. The one at the
bottom, #0, is the statement that was running when the program stopped.
#1 is the statement that called #0, #2 is the statement that called #1
and ...
If you click on one of these statements the main window will display the
code.
You should be able to figure it out from there. But remember you will
only see the code from your application because the ADMB and AUTODIF
libraries are not usually compiled with the -gdb option.
ddd is a pretty useful tool, but I have no idea how to do this in
Windoze. The Borland debugger was an even better tool (and prossibly the
only reason to use Windoze for programming), but I don't know if it
still works. Microsoft may offer a debgger for vc. Has any one ever used
it successfully?
Happy entomology,
John
On 02/27/2012 07:27 PM, Mollie Brooks wrote:
> I have a memory allocation error. I found Dave's response to this
> problem in the past.
> http://groups.google.com/group/admb-users/browse_thread/thread/bfdc7a95371c9bf6/1e5f21e161033c20?lnk=gst&q=memory+allocation+error&pli=1
> <http://groups.google.com/group/admb-users/browse_thread/thread/bfdc7a95371c9bf6/1e5f21e161033c20?lnk=gst&q=memory+allocation+error&pli=1>
>
> However, I was hoping to get some of the gaps filled in.
> Dave says
> "If you compile your program in debug mode and put a breakpoint in
> ad_exit()
> and do a stack trace you can find the line where this is happening. It
> may
> be that you are doing something like trying to allocate a vector where
> one of the arguments is uninitialized. "
>
> Broken down into steps this is:
> (1) compile your program in debug mode
> I know this means to compile code with option -g and execute it as gdb
> --args ./
> (2)put a breakpoint in ad_exit()
> (3)do a stack trace
>
> Could someone please elaborate on steps (2) and (3) for me?
>
> thanks,
> Mollie
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
More information about the Users
mailing list