Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:28:03+00:00 2026-05-28T08:28:03+00:00

I just can’t find a simple answer to this simple question I have from

  • 0

I just can’t find a simple answer to this simple question I have from Dr Google. I have the following serializing function which I put in a static module. It is called many times by my application to serialize lots of XML files. Will this cause memory to over grow? (Ignore the text write part of the code)

public static void SerializeToXML<T>(String inFilename,T t) 
{
    XmlSerializer serializer = new XmlSerializer(t.GetType());
    string FullName = inFilename;
    TextWriter textWriter = new StreamWriter(FullName);
    serializer.Serialize(textWriter, t); 
    textWriter.Close();
    textWriter.Dispose();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:28:04+00:00Added an answer on May 28, 2026 at 8:28 am

    Will this cause memory to over grow?

    No. There will be no memory over growing. static will let you call SerializeToXML method without create a new instance of the class. Not anything else.

    So if you’re calling this method many times, You even shrinking the memory usage with a static method.

    Though you wrote to ignore the text write part, You should use using statement for unmanaged resources:

    public static void SerializeToXML<T>(String inFilename,T t) 
    {
        XmlSerializer serializer = new XmlSerializer(t.GetType());
        string FullName = inFilename;
        using (TextWriter textWriter = new StreamWriter(FullName))
        {
            serializer.Serialize(textWriter, t); 
            textWriter.Close();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this maybe a basic question but I just can't seem to find
I have a simple redirect which I just can't get to work and I
I just can't find the right Google search terms for this... Is it possible
I just can not figure this out, or find any docs. I have a
i just can't seem to find a definitive answer to this issue, and django's
I just can't find my mistake... I have a csv-file with lines like this:
I just can't figure this out. I have a script that gets data from
I just can't work this one out. I have a table with a column
This ought to be simple but I just can't figure this one out: The
I just can't get this thing to work in javascript. So, I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.