garbage collection(2)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi all,
i have found out the problem but i could not find the solution yet.
code:
Public Class ReportProvider

dim dTable as DataTable
dim rprDoc as new ReportDocument()

public sub new(dataTable as DataTable)
me.dTable = dataTable
end sub

public sub generateReportDocument(byval ReportPath as string)
..
reportDocument.Load(ReportPath)
reportDocument.SetDataSource(dTable)
..
end sub
..
'after i used this class:
reportDocument.SetDataSource(Nothing)
reportDocument.dispose
reportDocument = Nothing
dTable.Dispose()
dTable = Nothing
GC.collect
..
end

as you can see from the code; i have a datatable and i set the datasource of
my reportDocument class with it. i dispose the datatable in reportProvider
class but reportDocument class already uses it. i must dispose it too but
..net does not allow me to access it. i can set datasource of reportdocument
class but i can not get and dispose it.
i want something like: when i dispose a form(or a class), all controls and
variables on it will be disposed too... or something like. i am disposing
report document but the datatable of report document is still on memory.

note: i dispose a variable but gc does not collect it. when i assigned it
"nothing" gc is collecting... so i must set the variable "nothing". disposing
is not enough... am i right?

thanks...

Ömer KUL
 
Omer,

Will you be so kind to keep it in the original thread

There are a lot of answers in that thread and only two reactions from you.

So now it could be that we start again and even don't know if you did try
the answers..

Cor
 
Back
Top