title: ASP.NET core high memory consume
body: <p>I have some ASP.NET core project and I was looking on memory that consumes. I just get terrified by it. It's not a that big project. I have a few controllers and it consumes about 350MB of Ram and that's a big amount of memory for the webserver. </p>
  
  <p>My question is can I somehow reduce it? One idea that I have is to you struct instead of a model for Data Relation Model, but that will not reduce that that mutch as I want to. Are some other ways, I like to try them all :)</p>
  
  <p>And the last thing, I now ASP.NET core is a very complex framework, that means I wont to use it for small Project this is just for education purposes. and last question: is the memory big problem?</p>
  
  <p>Screenshot of my project:
  <img src="https://i.stack.imgur.com/EzqAd.png" alt="Screenshot 1"></p>
  
  <p>my bigger controller :)</p>
  
  <pre><code>using System.Linq;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.EntityFrameworkCore;
  using RustWiki.Data;
  using RustWiki.Models.WikiViewModels;
  
  namespace RustWiki.Controllers.api
  {
  [Produces("application/json")]
  public class TableManagerController : Controller
  {
      private readonly ApplicationDbContext _context;
      public TableManagerController(ApplicationDbContext context)
      {
          _context = context;
      }
  
      protected override void Dispose(bool disposing)
      {
          _context.Dispose();
          base.Dispose(disposing);
      }
  
      //Get
      [HttpGet]
      [Route("/api/ArmorTypes")]
      public IActionResult GetArmorTypes() =&gt; Ok(_context.ArmorTypes.ToList());
  
      [HttpGet]
      [Route("/api/Cloating")]
      public IActionResult GetCloating() =&gt; Ok(_context.Cloating.Include(c =&gt; c.ArmorType).Include(c =&gt; c.Defencis).Include(c =&gt; c.Item.ItemType).ToList());
  
      [HttpGet]
      [Route("/api/Defencis")]
      public IActionResult GetDefences() =&gt; Ok(_context.Defencis.ToList());
  
      [HttpGet]
      [Route("/api/Dmgs")]
      public IActionResult GetDmg() =&gt; Ok(_context.Dmgs.ToList());
  
      [HttpGet]
      [Route("/api/Equipment")]
      public IActionResult GetEquipment() =&gt; Ok(_context.Equipment.Include(e =&gt; e.Dmg).Include(e =&gt; e.Item.ItemType).ToList());
  
      [HttpGet]
      [Route("/api/Items")]
      public IActionResult GetItems() =&gt; Ok(_context.Items.Include(i =&gt; i.ItemType).ToList());
  
      [HttpGet]
      [Route("/api/ItemTypes")]
      public IActionResult GetItemType() =&gt; Ok(_context.ItemTypes.ToList());
  
      [HttpGet]
      [Route("/api/Resources")]
      public IActionResult GetResource() =&gt; Ok(_context.Resources.ToList());
  
      //Delete
  
      [HttpDelete]
      [Route("/api/ArmourTypes/{id}")]
      public IActionResult DelArmourType(int id) =&gt; Delete(_context.ArmorTypes, id);
  
      [HttpDelete]
      [Route("/api/Cloating/{id}")]
      public IActionResult DelCloating(int id) =&gt; Delete(_context.Cloating, id);
  
      [HttpDelete]
      [Route("/api/Defences/{id}")]
      public IActionResult DelDefencis(int id) =&gt; Delete(_context.Defencis, id);
  
      [HttpDelete]
      [Route("/api/Dmgs/{id}")]
      public IActionResult DelDmg(int id) =&gt; Delete(_context.Dmgs, id);
  
      [HttpDelete]
      [Route("/api/Equipments/{id}")]
      public IActionResult DelEquipment(int id) =&gt; Delete(_context.Equipment, id);
  
      [HttpDelete]
      [Route("/api/Items/{id}")]
      public IActionResult DelItem(int id) =&gt; Delete(_context.Items, id);
  
      [HttpDelete]
      [Route("/api/ItemTypes/{id}")]
      public IActionResult DelItemType(int id) =&gt; Delete(_context.ItemTypes, id);
  
      [HttpDelete]
      [Route("/api/Resources/{id}")]
      public IActionResult DelResource(int id) =&gt; Delete(_context.Resources, id);
  
      private IActionResult Delete&lt;T&gt;(DbSet&lt;T&gt; set, int id) where T : class
      {
          var obj = set.SingleOrDefault(delegate (T o)
          {
              return (o as IWikiModel)?.Id == id;
          });
          if (obj == null)
              return NotFound();
          set.Remove(obj);
          _context.SaveChanges();
          return Ok(obj);
      }
  
      //Create
  
      [HttpPost]
      [Route("/api/ArmourType")]
      public IActionResult CreateArmourType([FromBody]ArmorType type)
      {
          return Ok();
      }
  }    
  }
  </code></pre>
  
  <p>Thanks for all the answers.</p>