Re: Error Using Remoting, System.OutOfMemoryException anyone ever seen this?



Beth

You are a life savior, that worked like a charm for me. I was able to use
it to transfer the DataSet to the client like I wanted.

Thank you so much for the help.

Clyde
"Beth Massi [Architect MVP]" <bmassi@xxxxxxxxxxx> wrote in message
news:eOe7qYNgFHA.3936@xxxxxxxxxxxxxxxxxxxxxxx
> If serialization is your problem (and a 50 meg dataset is rather large)
> you should serialize the dataset as binary. You can do this in v 2.0 of
> the .NET framework by setting the Dataset.RemotingFormat property equal to
> SerializationFormat.Binary. If you are using 1.1 of the .NET framework you
> will need to use a surrogate class. Take a look here for a link to the
> code:
> http://bethmassi.blogspot.com/2004/12/binary-serialization-of-datasets.html
>
> HTH,
> -B
>
> "Microsoft News" <Name@xxxxxxxxxxx> wrote in message
> news:%230nUfiLfFHA.1284@xxxxxxxxxxxxxxxxxxxxxxx
>> Greetings,
>>
>> I am working on a remoting project and have hit one road block after
>> another. I am sure it is because I do not know everything about
>> remoting.
>>
>> My latest problem is that I finally got the remoting to work they way I
>> want. I have a window service setup on my server, it is exposing a
>> datatier set of DLLs that implements a framework which will make calls to
>> the database and return a dataset back across the internet to the user
>> business tier DLL where the data will be used. It works great when the
>> data set is small. However when I return a large amount of information
>> it fails with the following problem:
>>
>> "System.OutOfMemoryException: Exception of type
>> System.OutOfMemoryException was thrown.
>>
>> Server stack trace:
>>
>>
>> Exception rethrown at [0]:
>> at
>> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
>> reqMsg, IMessage retMsg)
>> at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
>> msgData, Int32 type)
>> at MHSData.CBillingData.GetBillingItemsDS(Int64 plBillID, Int32 pnPAID,
>> Int32 pnUserID, Int16 piView)
>> at MHSBusiness.CBillables.GetBillableItems(Int64 plBillID, Int32
>> pnPAID, Int32 pnUserID, Filtering peView) in C:\Dev\Dev .Net\R&D
>> Code\Remoting\DataTierPrototype\MHSBusiness\CBillables.vb:line 63"
>>
>> So to provide some more details, I have a GUI that creates an object from
>> a class in my business tier. From this object I make a call to get data
>> from the database. This routine is the Get in the business tier. As you
>> can see I have a setup a call that you can pass the datatier routine name
>> to "CBillingData", and that will go out to a factory, and pull the
>> datatier object back across the internet using remoting.
>>
>> Public Function GetBillableItems(Optional ByVal plBillID As Long = 0,
>> Optional ByVal pnPAID As Integer = 0, Optional ByVal pnUserID As Integer
>> = 0, Optional ByVal peView As Filtering = Filtering.All) As Integer
>> Dim lobjData As CBillingData
>> Dim lnReturn As Integer
>>
>> lnReturn = 0
>> Try
>> clStartTick = Now.Ticks
>>
>> lobjData =
>> CType(MHSBusinessTier.GetDataTierObject("CBillingData"), CBillingData)
>> lnReturn = ParseDetails(lobjData.GetBillingItemsDS(plBillID,
>> pnPAID, pnUserID, peView))
>> Catch ex As MHSData.UnhandledSQLException
>> MessageBox.Show(ex.Message, "SQL Error - Getting Billable
>> Items")
>> lnReturn = -1
>> Catch ex As MHSData.UnhandledException
>> MessageBox.Show(ex.Message, "Error Getting Billable Items")
>> lnReturn = -1
>> Catch ex As Exception
>> MessageBox.Show(ex.ToString, "General Error")
>> lnReturn = -1
>> Finally
>> If Not (lobjData Is Nothing) Then
>> lobjData.Close()
>> lobjData = Nothing
>> End If
>> End Try
>>
>> Return lnReturn
>> End Function
>>
>> Then it will use that object to send parameters to. Then on the Datatier
>> side it will use those parameters to get data from the database and
>> return a dataset. This routine passes back a dataset with no problem
>> when the dataset is small but when it is large, for the test I am doing
>> it is about 50Megs of data, it then generate the error you see above.
>>
>> Public Function GetBillingItemsDS(ByVal plBillID As Long, ByVal pnPAID
>> As Integer, ByVal pnUserID As Integer, ByVal piView As Short) As DataSet
>> Implements CBillingData.GetBillingItemsDS
>> ' create a command...
>> Dim command As SqlCommand
>> Dim sqlParms As New SqlClient.SqlParameter
>> Dim adapter As SqlDataAdapter
>> Dim result As New DataSet
>>
>> Try
>> If mobjConnection.State = ConnectionState.Closed Then
>> mobjConnection.Open()
>> End If
>> ' create the command...
>> command = New SqlCommand("SP..Name..Here", mobjConnection)
>> command.CommandTimeout = TimeOutLength
>>
>> ' set it up as a sproc...
>> command.CommandType = CommandType.StoredProcedure
>>
>> .... Parameters are passed to SP here ....
>>
>> ' execute it...
>> adapter = New SqlDataAdapter(command)
>> adapter.Fill(result)
>> Catch ex As SqlException
>> WriteException("SQL Ex: " & ex.ToString)
>> Throw New UnhandledSQLException(ex)
>> Catch ex As Exception
>> WriteException("General Ex: " & ex.ToString)
>> Throw New UnhandledException(ex)
>> Finally
>> ' dispose...
>> If Not adapter Is Nothing Then
>> adapter.Dispose()
>> End If
>> If Not command Is Nothing Then
>> command.Dispose()
>> End If
>> End Try
>>
>> WriteException("Return: " & result.Tables.Count)
>>
>> Try
>> ' return...
>> Return result
>> Catch ex As Exception
>> WriteException("General Ex: " & ex.ToString)
>> End Try
>> End Function
>>
>> The error seems to be happening after the return has run and the function
>> has exit. I think it has to do with the serialization of the dataset.
>> Maybe it is taking to long.
>>
>> Now the machines I have tried this on have LOTS of memory from 512 - 2
>> GIG and the code still fails. I have set and watched the processes.
>>
>> As for memory use, the client which is hung is not peaked out of memory,
>> it is running 1% cpu usage and barely any memory used. The client
>> program is holding steady at 15Meg of memory usage. On the server the
>> server is holding at 98Meg of memory usage, 1% of CPU usage, and does not
>> even look like there is a process running.
>>
>> So if anyone have any ideas please let me know, post some code, what
>> should I do, HELP!
>>
>> Thanks
>>
>> Clyde
>>
>
>


.



Relevant Pages

  • Re: Memory usage and large number of pages
    ... The problem is the overhead of compiling these pages is huge - and because ... have also found that for each file that is compiled the memory increases. ... >> directory on the web server. ... >> returns the result of this page back to the client. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: x86 instructions guide
    ... one thing that is interesting is how the client ... of the data even if it resides in client side memory as array, ... --> The driver cannot return from the draw primitive command until it ... efficient but it is phased out; OpenGL ES for example has abandoned DL ...
    (alt.lang.asm)
  • Perfomance problem while passing large data volumes via WMI
    ... through WMI. ... the file is about 300 Mb) and we want to pass it to the client side. ... //these methods are memory and time consuming. ... My provider consumes about 1,5 Gb of memory ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Does Vista Home Premimum Play Nice With 4GB Memory?
    ... 32-bit Vista does not know how to manage 4 GB memory, which is odd, since ... It's not just Vista, it's *all* 32-bit client versions of Windows. ...
    (microsoft.public.windows.vista.general)
  • Re: plotting cpu and mem consumption
    ... >>amount of cpu usage and memory consumption of the program. ... > profiling library (or libraries, ...
    (comp.lang.cpp)