Re: how to clean user
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 10/23/2013 02:44 PM, Tad Szuba wrote: > Hi! > > One question more ... Please keep discussions on the list. > Let's say; the process of activating agent's inference in Prolog will be > activated 10 000 times (or more) > with abolish/1 at the end of every activation ... > > There will be any stack overflow danger ?? Why would there be? The program is not on the stack anyway. If you the code each time in a new module (and I guess try to destroy) the old one) you'll have 10,000 modules with in each of them the (now empty) predicates. That might be a serious amount of lost memory. You'd better to a bit of testing and math. Cheers --- Jan > > With best regards > Tad > //////////////////// > > -----Oryginalna wiadomość----- From: Jan Wielemaker > Sent: Wednesday, October 23, 2013 1:45 PM > To: Tad Szuba ; Prolog mailing list > Subject: Re: how to clean user > > Tad, > > There are enough ways to isolate and clean data. A total reset > is hardly ever a good idea and pretty hard to implement because > there is a lot of state in the system. Eventually, > SWI-Prolog is likely to get a transactional database, which can > simplify some of these scenarios. > > A bigger worry for this type of dynamically swapping code however is > that not everything is reclaimed, so you will suffer from memory leaks. > Notably modules, predicates and functors (name/arity pairs) are never > reclaimed. Modules can be wiped, but the module structure is not > deleted and while the clauses of a predicate are truely removed, the > predicate structure is not. > > So, somehow you have to ensure that you reuse modules and predicates > if you want to run 24*7. > > Cheers --- Jan > > On 10/23/2013 01:29 PM, Tad Szuba wrote: >> Hi! >> >> Thanks! - now I will experiment with abolish/1 >> >> However; I think, that function for reseting the user is necessary. >> >> I case of "intelligent agents" ; even single agent is restarting again >> and again his business planning strategy ; >> >> from scratch, because new facts are emerging and continuation of >> previous thread of inference is bad solution. >> >> With best regards >> Tad >> ////////////////////////////////// >> >> >> -----Oryginalna wiadomość----- From: Jan Wielemaker >> Sent: Wednesday, October 23, 2013 1:03 PM >> To: Tad Szuba ; Paul Singleton >> Subject: Re: how to clean user >> >> On 10/23/2013 11:48 AM, Tad Szuba wrote: >>> Hi! >>> >>> My Java --> Prolog --> Java system >>> for A. Smith Invisible Hand of Market simulations is "almost >>> working" >>> >>> however I face problem ... >>> >>> When Prolog is used for next agent to infer for him (file >>> wantsToBuy4878293086935712258) >>> >>> Prolog "user" remembers predicates from previous inference (file >>> wantsToBuy126437475720758049) >>> >>> see: >>> ERROR: c:/users/user/workspace/mainmodule4254950593641732242.pl:1: >>> import/1: No permission to import >>> wantsToBuy4878293086935712258:goodsWB/5 into user (already imported from >>> wantsToBuy126437475720758049) >>> >>> Question is on how to reset/clean "user" without total restart of Prolog >>> ... >> >> I guess that the simplest option is to make sure it isn't imported into >> user in the first place. I.e., do not export anything from your modules >> and simply call the predicate in its module. >> >> But, you can also call abolish/1 on these predicates. Abolish on an >> imported predicate removes the import, not the predicate itself. >> >> Cheers --- Jan >> >>> >>> I have found some old (2004) discussion regarding this problem between >>> Paul and Michal Jakob from >>> FEE Czech Technical University Prague; but without clear solution. >>> >>> With best regards >>> Tad Szuba >>> Cracow, Poland >>> >> > _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog