Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Why is this taking up all the memory?

Why is this taking up all the memory?

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestioncsharpperformance
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jan Sommer
    wrote on last edited by
    #1

    I'm using Lucene.Net to index a DB. Getting all the records is quickly done, but when i index them, the memory just keeps going up on my application. This is how the code looks:

    Private writer As Lucene.Net.Index.IndexWriter

    Private Sub InsertDBIndexData(ByVal sCPR As String)
    Dim doc As New Document
    Dim f1 As New Field("CPR", sCPR, Field.Store.YES, Field.Index.TOKENIZED)
    doc.Add(f1)
    writer.AddDocument(doc)
    doc = Nothing
    Return
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim odConnection As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=....mdb...")
    odConnection.Open()
    writer = New Lucene.Net.Index.IndexWriter(DBIndexLocation, New StandardAnalyzer, True)

        Dim odCommand As OleDbCommand = New OleDbCommand("select \* from TPers", odConnection)
        'Dim odReader As OleDbDataReader = odCommand.ExecuteReader
        Dim odDataAdaptor As OleDbDataAdapter = New OleDbDataAdapter(odCommand)
        Dim odDataSet As DataSet = New DataSet
        odDataAdaptor.Fill(odDataSet, "TPers")
    
        Dim odDataTable As DataTable = odDataSet.Tables("TPers")
    
        For Each dr As DataRow In odDataTable.Rows
            InsertDBIndexData(dr("cpr").ToString)
        Next
    
        writer.Optimize()
        writer.Close()
        odDataAdaptor.Dispose()
        odConnection.Close()
    End Sub
    

    i've tried to use oledbdatareader instead of oledbdataadaptor, which seems to be alot faster when indexing, but it is still takes up ALL the memory. Opening and closing the Lucene writer doesn't help either. I know i probably should be asking in some Lucene.Net forum, but i'm not sure if the problem lies in that code. And i know i've asked a question pretty much similar to this. But this isn't the same :)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups