I am using mid form in a windows forms application. Every time I am loading new child windows memory is going up(it’s ok). When I close them memory is not coming down. I am disposing child windows as they close.
Why is this happening ?
What is the solution for this problem ?
What are the best practices for memory management.
If you are using task manager to detect memory usage, what you are seeing is the programs working set and not the atuall memory usage.
You say you are using the Dispose method as you close windows. But do those child windows use any resources that are not automatically disposed?
Contrary to popular belief, .NET's automaticall memory management does not imply immediate 100% resource cleanup. Some resources have to be cleaned up manually to decrease memory footprint at any given time since the garbage collector funtions in a non-deterministic way.
Task manager show the program's working set, not the actual memory consumption at a given time. You can see this bi minimizing and then restoring your application. Task Manager refreshes the value and usually the new value is much less than the original one.
Although it is not a recommended practice, you can try forcing a garbage collection through GC.Collect().
How to Create a new Access database using C#?
i want create a new access database.i don't kown how to write the SQL expression.
and i want to kown is there other way to create a new database not use SQL language.beacause i kown there is ADOX in ado2.5 and it can create database.but i can't find anything can create database in ado.net.
The only other technique I know, and have used before, is to embed a blank database into the assembly and write it out to file using a binary stream whenever a new database is needed. I know, its ugly and bad, but it works. Though if you want to be able to create for different Access versions you'd need to embed each one, which is even more ugly and bad.