Skip to content

UseGridCustomHeap Method

Description

Tells the Grid control to create its own memory heap instead of letting MFC allocate memory (in standard mode, not virtual).

Syntax

Public Function UseGridCustomHeap() As Boolean

Return Type

Returns True if the Grid control creates its own memory heap to store grid resources.

Remarks

Typically, it should be fine to allow MFC to allocate memory. However, in some cases, if you are working with a really large dataset that you are removing and loading on a regular basis, memory may not be released, and UseGridCustomHeap should be used.

UseGridCustomHeap tells the Grid control to create its own memory heap instead of letting MFC allocate memory. This is particularly useful when adding and removing large numbers of rows repeatedly.

The issue arises because MFC allocates memory for the rows created, but it must create a whole page in memory. This page may also contain memory for other processes in Windows, not just the Grid control. When it comes time to delete the rows, the grid-related memory is marked for deletion, but the page cannot be removed as there are other Windows processes using it. This behavior is inherent to how MFC operates and is not a bug.

As a result, after deleting large amounts of records, the memory may not appear to be released. To overcome this limitation of MFC, you can use UseGridCustomHeap for the Grid control to create its own memory heap, allowing it to release all memory related to the rows when they are removed.

See Also

GridControlGlobalSettings Object


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.