Chris
Wed Nov 22 11:00:54 CST 2006
Ops. I read your number wrong.
You're only allocating 17 megabytes, not 1.7 gigabytes as I assumed.
Do a full GC.Collect first, and if you still have failures, then you're
probably suffering from heap fragmentation. Are you doing any calls out to
Win32? Using Sockets? Files?
--
Chris Mullins
"Chris Mullins" <cmullins@yahoo.com> wrote in message
news:%23uJDldlDHHA.4620@TK2MSFTNGP04.phx.gbl...
> There is no way to do this and be certain it's going to work.
>
> You're right at the edge of the max memory you can allocate in an x86
> process. You may get it to work sometimes by putting a full GC.Collect in
> there between allocations, but nothing you do is going to make it work
> every time.
>
> It may work sometimes in .Net 2.0 (running on x86), but there are going to
> be alot of times that it's not. You're right on the edge there.
>
> Your only real solution is to migrate to .Net 2.0, and run under x64 or
> IA64. Nothing else will work reliably.
>
> --
> Chris Mullins, MCSD.NET, MCPD:Enterprise
>
http://www.coversant.net/blogs/cmullins
>
>
> "raise" <raise@discussions.microsoft.com> wrote in message
> news:01E842D0-293F-4B2E-87B1-5980530191D3@microsoft.com...
>> Hi!
>>
>> I have the following problem on .net 1.1:
>>
>> I reduced the problem to the following code:
>>
>> byte[] ByteArrayOk=new byte[17000000];
>>
>> ByteArrayOk=null;
>>
>> byte[] ByteArrayOutOfMem=new byte[16773276]; // Exception here!!!
>>
>> ByteArrayOutOfMem=null;
>>
>> which throws a System.OutOfMemoryException.
>>
>> On .net framework 2.0 everything works fine!
>> But I need a shortterm solution on 1.1!
>>
>> Thanks for your help!
>>
>> raise
>>
>
>