   [SlimDX] Mesh.CreateText BUG ??
  Hello everybody.It i have found out that there are memory leaks with SlimDX.Direct3D9.Mesh.CreateText(). I prepared Windows Forms Application file which you can easy copy-paste-compile for test.using System;using System.Windows.Forms;using SlimDX.Direct3D9;using Font=System.Drawing.Font;namespace WindowsFormsApplication3{    public class Form1 : Form    {   private Button button1;   private Device device;   private int mi;   public Form1()   {  InitializeComponent();   }   protected override void OnLoad(EventArgs e)   {  base.OnLoad(e);  device = new Device(new Direct3D(),  0,  DeviceType.Hardware,  Handle,  CreateFlags.HardwareVertexProcessing | CreateFlags.FpuPreserve,  new PresentParameters());   }   private void button1_Click(object sender, EventArgs e)   {  for (int i = 0; i < 1000; i++)  { Mesh mesh = Mesh.CreateText(device, new Font("Times New Roman", 20), "Hello World", 0.001f, 0.001f); mesh.Dispose(); Text = mi++.ToString();  }   }   private void InitializeComponent()   {  button1 = new Button();  SuspendLayout();  //   // button1  //   button1.AutoSize = true;  button1.Text = "Generate meshes..";  button1.Click += button1_Click;  //   // Form1  //   Controls.Add(button1);  ResumeLayout(false);   }   /// <summary>   /// The main entry point for the application.   /// </summary>   [STAThread]   static void Main()   {  Application.EnableVisualStyles();  Application.SetCompatibleTextRenderingDefault(false);  Application.Run(new Form1());   }    }}Here is form with button. If you are click the button text 3D will creates and disposes in loop.In my experiment an application used 9 KB when started. Then i have pressed button and it became 48 KB. Why it does? I call dispose method each time after creation. I think that should be enough to free allocated resources, isn't it?   
  How are you measuring memory usage? Task Manager is not even remotely useful for the job, you can effectively ignore what it tells you (Unless you know what the working set is and what it actually means).   ;  There shouldn't be any leaks there. I doubt there is one in the SlimDX code for this, unless you are seeing a report in the output window when the program terminates informing you that you have unreleased mesh objects (you never dispose of the device, so you should see at least that one).How are you profiling the memory usage? If its via the task manager, that's not appropriate because it doesn't mean what you think it means.   ;  I measured it via Task Manager.. Ok, i agree that Task Manager is not proper utility for such cases. But what about run out of video/system memory. In my short experiments the memory usage always increased and never fall down..(EDIT: decreased => increased)   ;Quote:Original post by user88In my short experiments the memory usage always decreased and never fall down..Measured from where? Again, if you're using Task Manager, ignore it - it doesn't reflect the memory used by your application in the way you probably think it does.It's similar to seeing CPU usage at 100% and thinking that your app will stop everything else running.   ;Quote:But what about run out of video/system memory. I can see several ways to parse this sentence, but neither of them make a valid argument for attempting to rely on the task manager: it doesn't understand or display video memory statistics at all.   ;  Can you advise me any utility to watch memory usage while an application is running? I know that PIX can give precise information about that. But i should stop process to see it..   ;  PIX is good, CLR Profiler is good, WinDbg is good (but very hard to use). You can also use the .NET memory-related counters in perfmon.exe.There are non-free options as well -- .NET Memory Profiler, dotTrace, et cetera.   ;  I will try them. Thanks for help!   ;  I modified my experimental application a little.. Now button1_Click method looks next:   private void button1_Click(object sender, EventArgs e)   {  while(true)  { Mesh mesh = Mesh.CreateText(device, new Font("Times New Roman", 20), "Hello World", 0.00001f, 0.001f); mesh.Dispose(); Text = mi++.ToString(); Application.DoEvents();  }   }I have ran it and got exception when mesh was created/disposed 5783th time:SlimDX.Direct3D9.Direct3D9Exception E_OUTOFMEMORY: Ran out of memory (-2147024882).Is there something wrong in my code or that is a bug of slimdx?   