[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

XmlTextReader and Memory

andrerus

1/25/2008 11:53:00 AM

Hi. I've developed an application for Windows Mobile using 3.5 version
of CompactFramework.
My application generally uses (into the heap) approximately 7kB. Then
I decided to introduce a XML configuration feature, but now it needs
nearly 80kB!!!
Looking at the heap, I found a 64kB sized array allocated by the
constructor of XmlTextReader (used inside XmlDocument). The problem is
that, even if I close XmlTextReader or set to null my ConfiguratorObj,
and then do a GC.Collect(), that array isn't deallocated.

Looking at rotor sources, I found that the array is
private static byte* s_CharProperties;
of XmlCharType, that is setted to
new byte[CharPropertiesSize]
where
private const uint CharPropertiesSize = (uint)char.MaxValue + 1;

I can't understand what this array is and what it contains, so I can't
understand if this allocation is useful and normal, but I'd like to
continue using XML to configure my application without spend so much
memory.
Does anybody help me explaining what happens or also suggesting
different solution.

Andrea
2 Answers

Michael Nemtsev [MVP]

1/28/2008 9:29:00 AM

0

Hello andrerus@gmail.com,

I would refer this question to "compactframework" NG

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.c...

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


> Hi. I've developed an application for Windows Mobile using 3.5 version
> of CompactFramework.
> My application generally uses (into the heap) approximately 7kB. Then
> I decided to introduce a XML configuration feature, but now it needs
> nearly 80kB!!!
> Looking at the heap, I found a 64kB sized array allocated by the
> constructor of XmlTextReader (used inside XmlDocument). The problem is
> that, even if I close XmlTextReader or set to null my ConfiguratorObj,
> and then do a GC.Collect(), that array isn't deallocated.
> Looking at rotor sources, I found that the array is
> private static byte* s_CharProperties;
> of XmlCharType, that is setted to
> new byte[CharPropertiesSize]
> where
> private const uint CharPropertiesSize = (uint)char.MaxValue + 1;
> I can't understand what this array is and what it contains, so I can't
> understand if this allocation is useful and normal, but I'd like to
> continue using XML to configure my application without spend so much
> memory.
> Does anybody help me explaining what happens or also suggesting
> different solution.
> Andrea
>


Kevin Spencer

1/28/2008 11:21:00 AM

0

When you use XML Configuration, the configuration file is a serialized
instance of a class which is read and kept in memory during the life of the
process.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

<andrerus@gmail.com> wrote in message
news:92884780-9022-4275-976c-8f99b3f0e762@d70g2000hsb.googlegroups.com...
> Hi. I've developed an application for Windows Mobile using 3.5 version
> of CompactFramework.
> My application generally uses (into the heap) approximately 7kB. Then
> I decided to introduce a XML configuration feature, but now it needs
> nearly 80kB!!!
> Looking at the heap, I found a 64kB sized array allocated by the
> constructor of XmlTextReader (used inside XmlDocument). The problem is
> that, even if I close XmlTextReader or set to null my ConfiguratorObj,
> and then do a GC.Collect(), that array isn't deallocated.
>
> Looking at rotor sources, I found that the array is
> private static byte* s_CharProperties;
> of XmlCharType, that is setted to
> new byte[CharPropertiesSize]
> where
> private const uint CharPropertiesSize = (uint)char.MaxValue + 1;
>
> I can't understand what this array is and what it contains, so I can't
> understand if this allocation is useful and normal, but I'd like to
> continue using XML to configure my application without spend so much
> memory.
> Does anybody help me explaining what happens or also suggesting
> different solution.
>
> Andrea