Re: debugging memory usage
- From: Andrey Rybalchenko <first.last@xxxxxxx>
- Date: Mon, 30 Jan 2006 18:49:13 +0100
Thanks Bart! You suggestions sound very useful, independently of my particular program. I'll try them & report on the outcome.
I've solved the overall problem by modifying the program such that it computes in a different way, which does not produce a memory exception on the examples I've tried.
Best regards,
Andrey
Bart Demoen wrote:
Andrey Rybalchenko wrote:Dear group,
my sicstus prolog program, which implements some symbolic computations, terminates with the exception resource_error(0,memory). The behavior is reproducible, but takes about 10 hours to do so.
What is the best way to find out where the memory is consumed?
The "best" way might depend on how big your program is: if it not too big, I would do a visual inspection looking for left behind choicepoints, left recursion, and accumulating parameters that keep accumulating during 10 hours. I would also look for creation of new atoms/functors. If you know your program very well, you could do that on a larger program as well.
Another thing you could do: call statistics/0 when you get the exception. Any memory area that has grown will show up there. If you feel unsure about that, try to get out of memory with the following program:
a([X|R]) :- X = [1,2,3,4,5,6,7,8,9,0,_], a(R).
a :- a, b.
d :- d. d.
once with the query ?- a(_). and once with ?- a. and once with ?- d. and look at the output of statistics/0 and which areas have become big. Compare it to what statistics shows after your own program has run out of memory. You might not have learned very much, but at least you might know whether the overflow is because of term creation, choicepoints or recursion depth.
If the program is not too big, put it on a website so that we can see it.
Tell us about the outcome please :-)
Cheers
Bart Demoen
.
- References:
- debugging memory usage
- From: Andrey Rybalchenko
- Re: debugging memory usage
- From: Bart Demoen
- debugging memory usage
- Prev by Date: Re: Calling Prolog predicates from a C program.
- Next by Date: Re: The Bridge crossing prolog program
- Previous by thread: Re: debugging memory usage
- Next by thread: short prolog program enclosed, need a review please
- Index(es):
Relevant Pages
|
|