Hi,

From: "Gyhra, Norman (Student Assistant)" <[EMAIL PROTECTED]>
> Is it "normal" that (save-facts) seems to
> consume a huge amount of memory ?

Yes, because JESS dumps all facts into a big string and only then writes the
string to the file.  [The following is not a criticism to JESS, but rather
to Sun's design choice of Object.toString(), and an attempt to convince
people to avoid that.]  Formatting methods that return a String are not
stream-friendly. It's much better to have a "toStream (PrintWriter)" method
so you can dump stuff into whatever stream you want without the performance
issues: in addition to memory usage for big streams, there is an excess of
object creation, GC, and String concatenation, due to the recursive
combinationuse of enormous numbers of temporary, immutable string values).
toString()-like methods can be implemented as simple wrappers that invoke
toStream() over a StringWriter object; you can do that only once if many
objects share some root-like class.

> I use the NT task manager to watch the memory usage
> of my Jess program. It remains quite stable during the
> processing of rules. I tested with a 10 meg fact file
> that consumes about 50 megs of memory.
>
> However, as soons as I write my fact base into a
> file the usage jumps up to twice the value.
>
> As I want to use much larger fact bases later on,
> this behaviour might cause some serious memory problems.
>
> Any way to get around that?
> Thanks for any help.
>
> Jess 5.1
> Java 1.3
> P3-450
> 512 MB RAM
>
> Regards,
> Norman
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list (use your own address!) List problems? Notify
[EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
>




---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to