Re: Java heap space

Gonzalo "D?az" <[email protected]> Fri, 15 Sep 2006 09:31:57 -0700 (PDT)
Newsgroups gmane.comp.db.mckoi
Message-ID <[email protected]>
Thank you.
Has this patch been applied to the nighty build?
Sorry for asking this, I don't know how your build
process works. I got the nighty build but the error
persists.
Are users supposed to chec out from CVS and apply the
patch isolatedly instead?

   Gonzalo

PS: While I am at it, I would like to volunteer for
replacing all the "enum" variable names by something
else, to see if i can be compiled in 1.5.



--- Stefaan A Eeckels <[email protected]> wrote:

> On Thu, 14 Sep 2006 21:07:48 +0200
> Stefaan A Eeckels <[email protected]> wrote:
> 
> > OK, I can reproduce this. I'd have to look in the
> source code to see
> > what causes the out of memory error.
> 
> I've found (and fixed) the problem. Two messages
> with attachments have
> failed to materialize on the list, which might be
> caused by the
> attachments. Hence this message, with the patch as a
> text attachment.
> 
> Here's the text from the previous messages:
> 
> > It's a bug in the code - the  'E\\_%' pattern
> causes an endless
> > loop in PatternSearch.search. I have a fix for
> this that -after
> > cursory testing- seems to work. 
> > 
> > I attach a patch with the fix as well as a fix for
> the compilation
> > with Java 5 (McKoi used "enum" as a variable name,
> in Java 5 it's a
> > reserved word).
> > 
> > Mckoi with the attached patch and compiled with
> Java 1.5.008 is
> > running quite nicely.
> 
> 
> -- 
> Stefaan
> -- 
> As complexity rises, precise statements lose
> meaning,
> and meaningful statements lose precision. -- Lotfi
> Zadeh 
> > diff -urw
> mckoi1.0.3/src/com/mckoi/database/FunctionTable.java
>
mckoi1.0.3.sae//src/com/mckoi/database/FunctionTable.java
> ---
> mckoi1.0.3/src/com/mckoi/database/FunctionTable.java
> Tue Apr  8 01:55:02 2003
> +++
>
mckoi1.0.3.sae//src/com/mckoi/database/FunctionTable.java
> Thu Sep 14 22:58:37 2006
> @@ -239,12 +239,12 @@
>  
>      // Set up 'whole_table_group' to the list of
> all rows in the reference
>      // table.
> -    RowEnumeration enum =
> getReferenceTable().rowEnumeration();
> -    whole_table_is_simple_enum = enum instanceof
> SimpleRowEnumeration;
> +    RowEnumeration theEnum =
> getReferenceTable().rowEnumeration();
> +    whole_table_is_simple_enum = theEnum instanceof
> SimpleRowEnumeration;
>      if (!whole_table_is_simple_enum) {
>        whole_table_group = new
> IntegerVector(getReferenceTable().getRowCount());
> -      while (enum.hasMoreRows()) {
> -       
> whole_table_group.addInt(enum.nextRowIndex());
> +      while (theEnum.hasMoreRows()) {
> +       
> whole_table_group.addInt(theEnum.nextRowIndex());
>        }
>      }
>  
> @@ -425,9 +425,9 @@
>        // This means there is no grouping, so merge
> with entire table,
>        int r_count = table.getRowCount();
>        row_list = new IntegerVector(r_count);
> -      RowEnumeration enum = table.rowEnumeration();
> -      while (enum.hasMoreRows()) {
> -        row_list.addInt(enum.nextRowIndex());
> +      RowEnumeration theEnum =
> table.rowEnumeration();
> +      while (theEnum.hasMoreRows()) {
> +        row_list.addInt(theEnum.nextRowIndex());
>        }
>      }
>  
> diff -urw
>
mckoi1.0.3/src/com/mckoi/database/NaturallyJoinedTable.java
>
mckoi1.0.3.sae//src/com/mckoi/database/NaturallyJoinedTable.java
> ---
>
mckoi1.0.3/src/com/mckoi/database/NaturallyJoinedTable.java
> Sat Sep 21 21:37:06 2002
> +++
>
mckoi1.0.3.sae//src/com/mckoi/database/NaturallyJoinedTable.java
> Thu Sep 14 22:58:50 2006
> @@ -86,9 +86,9 @@
>     */
>    private static IntegerVector
> createLookupRowList(Table t) {
>      IntegerVector ivec = new IntegerVector();
> -    RowEnumeration enum = t.rowEnumeration();
> -    while (enum.hasMoreRows()) {
> -      int row_index = enum.nextRowIndex();
> +    RowEnumeration theEnum = t.rowEnumeration();
> +    while (theEnum.hasMoreRows()) {
> +      int row_index = theEnum.nextRowIndex();
>        ivec.addInt(row_index);
>      }
>      return ivec;
> diff -urw
> mckoi1.0.3/src/com/mckoi/database/PatternSearch.java
>
mckoi1.0.3.sae//src/com/mckoi/database/PatternSearch.java
> ---
> mckoi1.0.3/src/com/mckoi/database/PatternSearch.java
> Mon Feb  3 13:42:58 2003
> +++
>
mckoi1.0.3.sae//src/com/mckoi/database/PatternSearch.java
> Fri Sep 15 10:17:34 2006
> @@ -204,7 +204,6 @@
>  
>      // Look at first character in pattern, if it's
> a ONE_CHAR wildcard then
>      // check expression and pattern match until
> next wild card.
> -
>      if (pattern.charAt(0) == ONE_CHAR) {
>  
>        // Else step through each character in
> pattern and see if it matches up
> @@ -382,6 +381,7 @@
>  
>      StringBuffer pre_pattern = new StringBuffer();
>      int i = 0;
> +    int j = 0;
>      boolean finished = i >= pattern.length();
>      boolean last_is_escape = false;
>  
> @@ -388,14 +388,24 @@
>      while (!finished) {
>        char c = pattern.charAt(i);
>        if (last_is_escape) {
> -        last_is_escape = true;
> +        last_is_escape = false;
>          pre_pattern.append(c);
> +        j++;
> +        ++i;
> +        if (i >= pattern.length()) {
> +          finished = true;
>        }
> +      }
>        else if (c == escape_char) {
>          last_is_escape = true;
> +        ++i;
> +        if (i >= pattern.length()) {
> +          finished = true;
>        }
> +      }
>        else if (!isWildCard(c)) {
>          pre_pattern.append(c);
> +        j++;
>  
>          ++i;
>          if (i >= pattern.length()) {
> @@ -446,8 +456,8 @@
>        // 'Geoff\33'
>  
>        String lower_bounds = new
> String(pre_pattern);
> -      int next_char = pre_pattern.charAt(i - 1) +
> 1;
> -      pre_pattern.setCharAt(i - 1, (char)
> next_char);
> +      int next_char = pre_pattern.charAt(j - 1) +
> 1;
> +      pre_pattern.setCharAt(j - 1, (char)
> next_char);
>        String upper_bounds = new
> String(pre_pattern);
>  
>        post_pattern = pattern.substring(i);
> diff -urw
> mckoi1.0.3/src/com/mckoi/database/Table.java
> mckoi1.0.3.sae//src/com/mckoi/database/Table.java
> --- mckoi1.0.3/src/com/mckoi/database/Table.java	Tue
> Mar  4 16:11:40 2003
> +++
> mckoi1.0.3.sae//src/com/mckoi/database/Table.java
> Fri Sep 15 01:29:08 2006
> @@ -1597,9 +1597,9 @@
>     */
>    public final IntegerVector selectAll() {
>      IntegerVector list = new
> IntegerVector(getRowCount());
> -    RowEnumeration enum = rowEnumeration();
> -    while (enum.hasMoreRows()) {
> -      list.addInt(enum.nextRowIndex());
> +    RowEnumeration theEnum = rowEnumeration();
> +    while (theEnum.hasMoreRows()) {
> +      list.addInt(theEnum.nextRowIndex());
>      }
>      return list;
>    }
> @@ -1751,9 +1751,9 @@
>    public Map toMap() {
>      if (getColumnCount() == 2) {
>        HashMap map = new HashMap();
> -      RowEnumeration enum = rowEnumeration();
> -      while (enum.hasMoreRows()) {
> -        int row_index = enum.nextRowIndex();
> +      RowEnumeration theEnum = rowEnumeration();
> +      while (theEnum.hasMoreRows()) {
> +        int row_index = theEnum.nextRowIndex();
>          TObject key = getCellContents(0,
> row_index);
>          TObject value = getCellContents(1,
> row_index);
>          map.put(key.getObject().toString(),
> value.getObject());
> diff -urw
>
mckoi1.0.3/src/com/mckoi/database/control/DefaultDBConfig.java
>
mckoi1.0.3.sae//src/com/mckoi/database/control/DefaultDBConfig.java
> ---
>
mckoi1.0.3/src/com/mckoi/database/control/DefaultDBConfig.java
> Tue Jul 23 00:31:36 2002
> +++
>
mckoi1.0.3.sae//src/com/mckoi/database/control/DefaultDBConfig.java
> Thu Sep 14 22:55:47 2006
> @@ -93,10 +93,10 @@
>      Properties config = new Properties();
>      config.load(new BufferedInputStream(input));
>      // For each property in the file
> -    Enumeration enum = config.propertyNames();
> -    while (enum.hasMoreElements()) {
> +    Enumeration theEnum = config.propertyNames();
> +    while (theEnum.hasMoreElements()) {
>        // Set the property value in this
> configuration.
> -      String property_key = (String)
> enum.nextElement();
> 
=== message truncated ===> 
>
---------------------------------------------------------------
> Mckoi SQL Database mailing list 
> http://www.mckoi.com/database/
> To unsubscribe, send a message to
[email protected]


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/
To unsubscribe, send a message to [email protected]