I have a snippet of code that I use to output HTML mixed with the data I
bring back from an JDBC query. I am concerned about using excess resources by
creating too many objects and tying up memory. Is there any way I can make sure
the memory is freed up? Will .flush() help?

while (dataResultSet.next())
         {
           aClassified = new Classified(dataResultSet); // This is the line I am concerned with.
            tableBody.append(aClassified.toTableString(rowCount));
            rowCount++;

            // Dump out the values of each row
            for (int i = 0; i < columnCount; i++) {

             // Note that the column index is 1-based.
             String data = dataResultSet.getString(i + 1);

             // If this is the UniqueDateId column, cache it.
             // Note: first column is counted as 0.

             if (i == 0) {
              DateId = data;
         }
       }

        // If we are keeping track of the maximum number of
       // rows per page and we have exceeded that count
       // break out of the loop
    if((rowsPerPage > 0) && (rowCount >= rowsPerPage)){
     // Find out if their are any more rows after this one.
     more = dataResultSet.next();
     break;
    }
         }

Reply via email to