Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330661

Summary: Add support for VIRTUAL mode
Product: z_Archived Reporter: Willy Michel <wmichel>
Component: NebulaAssignee: Mirko Paturzo <caosmpz>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: caosmpz, cgross
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Willy Michel CLA 2010-11-19 08:25:11 EST
Build Identifier: I20100608-0911

It is possible to create the Grid with the VIRTUAL flag. But it will probably not be considered. As a result I get an OutOfMemoryError.

Reproducible: Always

Steps to Reproduce:
I prepared the GridSnippet1 code to reproduce this issue:

public class GridSnippet1
{
  public static void main( String[] args )
  {
    Display display = new Display();
    Shell shell = new Shell( display );
    shell.setLayout( new FillLayout() );

    Grid grid = new Grid( shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL );
    grid.setHeaderVisible( true );
    GridColumn column = new GridColumn( grid, SWT.NONE );
    column.setTree( true );
    column.setText( "Column 1" );
    column.setWidth( 100 );
    GridItem item1 = new GridItem( grid, SWT.NONE );
    item1.setText( "Root Item" );
    GridItem item2 = new GridItem( item1, SWT.NONE );
    item2.setText( "Second item" );
    GridItem item3 = new GridItem( item2, SWT.NONE );
    item3.setText( "Third Item" );

    grid.setItemCount( 1000000 );

    shell.setSize( 200, 200 );
    shell.open();
    while ( !shell.isDisposed() )
    {
      if ( !display.readAndDispatch() )
        display.sleep();
    }
    display.dispose();
  }
}
Comment 1 Mirko Paturzo CLA 2014-05-06 09:23:37 EDT
Patch https://bugs.eclipse.org/bugs/show_bug.cgi?id=385300 avoid OOM in creation phase.
Please see GridVirtualTableViewer.java snippet.