tailieunhanh - Visual Basic 2005 Design and Development - Chapter 23

Memory Management Thông thường, các nhà phát triển có quản lý bộ nhớ cho các cấp, và đúng như vậy. Trong hầu hết các trường hợp, hệ thống quản lý bộ nhớ. NET xử lý tất cả các chi tiết về việc tạo ra và phá hủy các đối tượng để bạn có thể tập trung vào ứng dụng của bạn và không phải là chi tiết sổ sách kế toán. Tuy nhiên, có lần khi nó hữu ích để biết một chút về bộ nhớ được quản lý trong ứng dụng. Đối với một số loại ứng dụng, một. | Memory Management Normally developers take memory management for granted and rightly so. In most cases the .NET memory-management system handles all the details about creating and destroying objects so that you can concentrate on your application and not bookkeeping details. However there are times when it s useful to know a bit about how memory is managed in the application. For certain types of applications a few changes to the way you handle objects can make a big difference in overall performance. This chapter explains how memory management works in Visual Basic. It explains some techniques you can use to minimize impact on the memory-management system and it tells how to make your memory use more efficient. Before you can learn about specific techniques for managing memory however you must understand a little about how the memory system works. In particular you must know a bit about the garbage collector. Garbage Collection Visual Basic .NET uses a garbage-collection memory-management scheme. As a program creates objects the system takes unused memory from the managed heap. When the program no longer has any variables referring to an object the object is freed and its memory is potentially available for reuse. However the garbage collector doesn t yet know that the object has been freed. Over time the program creates new objects and frees others. Eventually the managed heap runs out of free memory. At that point the garbage collector runs. Part IV Specific Techniques Actually the garbage collector can execute whenever it thinks it will be profitable to do so. That may be when the managed heap is really empty or it may be when the garbage collector thinks enough objects have been freed that it would be a good idea to clean things up a bit. Generally you should assume that the garbage collector might run at any time and not worry about exactly when it runs. The garbage collector now performs garbage collection to free up memory that was used but is no longer .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.