Stack Overflow in liars10000.txt - How can I measure performance?

This is a discussion on Stack Overflow in liars10000.txt - How can I measure performance? within the Tech Board forums, part of the Community Boards category; We have as a bonus assignment to write the liars problem in programming with constraints (with prolog, in certain environments, ...

  1. #1
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694

    Stack Overflow in liars10000.txt - How can I measure performance?

    We have as a bonus assignment to write the liars problem in programming with constraints (with prolog, in certain environments, ic, fd, swi-prolog, etc.)

    We are given some txt files, with the input, which is of the form
    claim1
    claim2
    ...
    claimN
    ,where claimI is a number, with i to run from 1 to N.

    I read from the current file and I create a list, which the actual input in the predicate that solves the problem.

    When I am trying to run in my laptop the problem for N = 10000, I am getting a stack overflow
    > *** Overflow of the global/trail stack in spite of garbage collection!
    > You can use the "-g kBytes" (GLOBALSIZE) option to have a larger stack.
    > Peak sizes were: global stack 127040 kbytes, trail stack 4416 kbytes

    I think that increasing the size of the stack will not get me far. Any ideas how to bypass the problem and take these measurements?
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,510
    don't use the stack. use dynamic memory. then you won't have to worry about stack overflow.
    Code:
    namespace life
    {
        const bool change = true;
    }

  3. #3
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    If I was in C/C++, I would do that with malloc/new, but how can I do something like that in prolog? The only thing that comes to mind is the assert/retract, but this is for the database of the program... Since it's a bonus assignment, nothing has been told in class :/
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  4. #4
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    The overflow occurs in the search method of the ic library!
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stack overflow....
    By roaan in forum C Programming
    Replies: 16
    Last Post: 09-09-2009, 11:31 AM
  2. Stack Overflow
    By ldb88 in forum C++ Programming
    Replies: 4
    Last Post: 07-24-2007, 09:07 AM
  3. stack overflow
    By TechHigh in forum C Programming
    Replies: 12
    Last Post: 01-11-2007, 12:49 PM
  4. stack vs heap performance
    By ufsargas in forum C Programming
    Replies: 3
    Last Post: 06-21-2006, 12:23 PM
  5. Stack Overflow
    By madmardigan53 in forum C++ Programming
    Replies: 2
    Last Post: 08-10-2003, 12:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21