Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 6399 Details for
Bug 30807
[Dialogs] Better dialog if OutOfMemory Exception is caught
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Simple test action to cause OutOfMemoryError
CreateOutOfMemoryError.java (text/plain), 2.39 KB, created by
John Arthorne
on 2003-10-10 11:09:26 EDT
(
hide
)
Description:
Simple test action to cause OutOfMemoryError
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2003-10-10 11:09:26 EDT
Size:
2.39 KB
patch
obsolete
>/********************************************************************** > * Copyright (c) 2003 IBM Corporation and others. All rights reserved. This > * program and the accompanying materials are made available under the terms of > * the Common Public License v1.0 which accompanies this distribution, and is > * available at http://www.eclipse.org/legal/cpl-v10.html > * > * Contributors: > * IBM - Initial API and implementation > **********************************************************************/ >package org.eclipse.core.jobman.test.actions; > >import java.util.ArrayList; > >import org.eclipse.core.resources.IWorkspaceRunnable; >import org.eclipse.core.resources.ResourcesPlugin; >import org.eclipse.core.runtime.*; >import org.eclipse.core.runtime.jobs.ILock; >import org.eclipse.core.runtime.jobs.Job; >import org.eclipse.jface.action.IAction; >import org.eclipse.jface.viewers.ISelection; >import org.eclipse.ui.IWorkbenchWindow; >import org.eclipse.ui.IWorkbenchWindowActionDelegate; > >/** > * > */ >public class CreateOutOfMemoryError implements IWorkbenchWindowActionDelegate { > protected IWorkbenchWindow window; > protected final ILock lock = Platform.getJobManager().newLock(); > public CreateOutOfMemoryError() { > super(); > } > public void dispose() { > } > > public void init(IWorkbenchWindow window) { > this.window = window; > } > public void run(IAction action) { > //create an OutOfMemoryError job > Job job = new Job("Bloat") { > final ArrayList container = new ArrayList(); > protected IStatus run(IProgressMonitor monitor) { > try { > ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { > public void run(IProgressMonitor monitor) throws CoreException { > try { > //sleep for awhile to let UI lock elsewhere > Thread.sleep(10000); > } catch (InterruptedException e1) { > } > int size = 1024 * 1024; > while (size > 100) { > try { > while (true) { > container.add(new byte[size]); > } > } catch (OutOfMemoryError e) { > size /= 2; > } > } > //one last alloc to blow the OutOfMemoryError > container.add(new byte[1024*1024]); > } > }, monitor); > } catch (CoreException e) { > e.printStackTrace(); > } > return Status.OK_STATUS; > } > }; > job.schedule(); > } > public void selectionChanged(IAction action, ISelection selection) { > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 30807
: 6399