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 9254577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:30:20+00:00 2026-06-18T11:30:20+00:00

I have a WCF client and I connect to a WCF server hosted in

  • 0

I have a WCF client and I connect to a WCF server hosted in a Windows service. In the service I read the last day entries from the Security event log. Then I parse the entries and create my own List<Data> which I return to my WCF client to display it in a DataGrid. The problem is that in the Security event log I have 30000 entries and after I parse every entry I create 30000 of new objects of type Data. This type is a class with 15 string properties which contains the details from the messages from the event log. After the whole process, the memory usage of the Windows service goes up with 60-70MB. Once I send this large set of data to the client, how can I lower the memory used by Windows service from 70-80MB to the default 10MB ?

Here is my code:

public List<Data> GetConnections()
{        
   var eventLog = new EventLog("Security");
   var fromDate = DateTime.Now.AddDays(-1);
   var entries = (from EventLogEntry e in eventLog.Entries
                   where (e.InstanceId == m_EventNumber) && e.TimeGenerated >= fromDate orderby e.TimeGenerated
                   select e).ToList()
                            .OrderByDescending(x => x.TimeGenerated);

   var items = new List<Data>();
   foreach(var item in entries)
   {
      var nData = ParseMessage(item.Message);
      if (nData != null)
          items.Add(ruleData);
   }
   return items;
}
  • 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-06-18T11:30:21+00:00Added an answer on June 18, 2026 at 11:30 am

    A bit more efficient code: only one loop instead of two, less objects to collect by GC.

    var q = from EventLogEntry e in eventLog.Entries
            where (e.InstanceId == m_EventNumber) && e.TimeGenerated >= fromDate orderby e.TimeGenerated
            order by e.TimeGenerated desc
            let r = ParseMessage(e.Message)
            where r != null
            select r;
    
    return new List<Data>(q);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF client & service, where service (which is hosted inside a
System Description: I have a WCF service (self hosted in a windows service) which
I want to connect to a wcf json service hosted on windows azure with
I have a WCF self-hosted service in a Windows Forms application. I am going
I have a simple self hosted WCF Console windows app, and I can connect
I have a WCF service lib and client[Winform] that connect using netTCPbinding. the client
I have a Linux/c client app that connects to a WCF web service over
I have a WCF client/service app that relies on secure communication between two machines
I have a WCF client that I'm having problems with. From time to time
I have a REST service consumed by a .Net WCF client. When an error

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.