Re: getting Segmentation Violation



"000.tushar@xxxxxxxxx" <000.tushar@xxxxxxxxx> writes:

thanks for replying. I need to specify few more details to make the
problem clearer. I am using Allegro CL 7 on windows machine with 512
mb RAM.

On Jan 8, 2:02Ž am, vanekl <va...@xxxxxxx> wrote:
On Jan 7, 3:18Ž pm, "000.tus...@xxxxxxxxx" <000.tus...@xxxxxxxxx>
wrote:

hello all,

I am developing a lisp application which analyzes the source code.
During analysis Ž it creates many objects using make-instance. The
problem is ....the program consumes available memory and PF usage
reaches to 1.90 GB and program emits an exception 'Segmentation
violation: error no 11'
To optimize it, Ž I am now using secondary storage to dump the
intermediate objects and retrieving them back whenever required. But
still...I am not getting rid of the problem(even though many make-
instance are removed).

Apart from these, I also tried these:-
1. I am calling GC explicitly.

This normally shouldn't matter, unless you have an implementation with a
generational collector and there is some feature of your GC that allows
explicit calls to examine and reclaim storage from what would otherwise
be deemed to be permanent generations.

2. I was passing heavy hash tables previously from one function to
other, i identified them and made them global.

That shouldn't matter at all. Values passed as arguments in Lisp are
not copied, so only a pointer to the hash table would be passed. So you
wouldn't expect there to be any change:

Still...there is almost zero performance gain. :(

If you are running out of heap space, then you must have some objects
being kept around. Lisp can't GC any object to which there is a live
pointer. You mention hash tables, especially big ones. So any objects
that are referenced (stored) in those hash tables will continue to
consume memory. It can't go away, because the hash table in question
provides a means of accessing it. If you make those hash table global,
the problem is likely to only get worse, since then they never go away.

If I had to guess, I would suppose that you are keeping references to
those intermediate objects somewhere in your code. That prevents them
from becoming garbage, and thus the storage never gets freed.

As for how to track this down, it is somewhat tricky. Check the GC and
memory space information documentation that comes with your Lisp
implementation. Perhaps there is a way of seeing how much memory is
allocated and to which objects. That could give you some clues as to
where you are hanging onto objects that you no longer need.

Using global variables is one way to keep references to objects. Make
sure that you use lexical variables so that they release references to
objects and tables when they are no longer needed.

You mention that you now use secondary storage. After you save the
objects to the secondary storage, are you sure that you are getting rid
of the references to those objects? If you continue to maintain
references, then secondary storage alone won't help you.


--
Thomas A. Russ, USC/Information Sciences Institute
.



Relevant Pages

  • Re: References - problem understanding them
    ... I'd expect accessing the hash in main doesn't work because it doesn't ... I don't know the details of how references are implemented in Perl, but they are more than just a bare pointer like that you would get in C. ... The reason that your example works is that Perl is a garbage-collected language, and many garbage-collected languages maintain counts of references to chunks of memory that are allocated. ...
    (comp.lang.perl.misc)
  • Re: WeakHashMap for values
    ... Hash: SHA1 ... The first idea is to have a Map mapping lists to objects ... weak references, and do some cleanup in the map from time to time. ... public class WeakValueHashMap extends HashMap { ...
    (comp.lang.java.programmer)
  • Re: undif as if it is 0
    ... or there is an operator to change undif to ... That will force a "numerification" of $max, ... I note that you are pushing references to the hash %set to the ...
    (comp.lang.perl.misc)
  • WeakHashMap for values
    ... Hash: SHA1 ... but with the inverse function: ... The first idea is to have a Map mapping lists to objects ... weak references, and do some cleanup in the map from time to time. ...
    (comp.lang.java.programmer)
  • Re: using a variable to create a new variable
    ... Symbolic references are forbidden under the "use strict" ... tures, particularly hashes. ... %main::) instead of a user-defined hash. ... use another scalar variable to refer to those by name. ...
    (perl.beginners)