Images in accelerated memory are much faster to draw on the screen. However, accelerated memory is typically limited and it is usually necessary for an application to manage the images residing in this space. This example demonstrates how to determine the amount free accelerated available.

Note: There appears to be a problem with GraphicsDevice.getAvailableAcceleratedMemory() on some systems. The method returns 0 even if accelerated image memory is available. A workaround is to create a temporary volatile image on the graphics device before calling the method. Once the volatile image is created, the method appears to return the correct value on all subsequent calls.

See also e601 Enabling Full-Screen Mode and e674 创建并绘制加速图像.

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
try {
GraphicsDevice[] gs = ge.getScreenDevices(); // Get current amount of available memory in bytes for each screen
for (int i=0; i<gs.length; i++) {
// Workaround; see description
VolatileImage im = gs[i].getDefaultConfiguration().createCompatibleVolatileImage(1, 1); // Retrieve available free accelerated image memory
int bytes = gs[i].getAvailableAcceleratedMemory();
if (bytes < 0) {
// Amount of memory is unlimited
} // Release the temporary volatile image
im.flush();
}
} catch (HeadlessException e) {
// Is thrown if there are no screen devices
}
Related Examples

e673. Getting Amount of Free Accelerated Image Memory的更多相关文章

  1. SAP work process Memory allocate

    Memory allocation sequence to dialog work processes in SAP What is the memory allocation sequence to ...

  2. PatentTips – GPU Saving and Restoring Thread Group Operating State

    BACKGROUND OF THE INVENTION The present invention relates generally to single-instruction, multiple- ...

  3. Reactor by Example--转

    原文地址:https://www.infoq.com/articles/reactor-by-example Key takeaways Reactor is a reactive streams l ...

  4. nginx_mysql_redis配置

    #Nginx所用用户和组,window下不指定 #user nobody; #工作的子进程数量(通常等于CPU数量或者2倍于CPU) worker_processes 2; #错误日志存放路径 #er ...

  5. redis配置详解

    ##redis配置详解 # Redis configuration file example. # # Note that in order to read the configuration fil ...

  6. Basic linux command-with detailed sample

    Here I will list some parameters which people use very ofen, I will attach the output of the command ...

  7. Redis(一) 介绍

    先说明下,本人是在windows系统下用的. 简单介绍一下,是nosql数据库,采用key-value存储方式形式.可用于处理高并发日志.维护top表等. 如果把它完全当初数据库使用,当做小型数据库还 ...

  8. Redis 配置文件

    # Redis configuration file example. # # Note that in order to read the configuration file, Redis mus ...

  9. Redis 配置文件详解

    # Redis 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, 5GB, 4M 等类似的格式,其转换方式如下(不区分大小写)## 1k => 1000 bytes# 1kb => ...

随机推荐

  1. Note for video Machine Learning and Data Mining——training vs Testing

    Here is the note for lecture five. There will be several points  1. Training and Testing  Both of th ...

  2. sqlserver计算时间差DATEDIFF 函数

    DATEDIFF 函数 [日期和时间] 功能 返回两个日期之间的间隔. 语法 DATEDIFF ( date-part, date-expression-1, date-expression-2 ) ...

  3. Codeforces 441C Valera and Tubes

    题目链接:Codeforces 441C Valera and Tubes 没看到r >= 2一直错.让前几个管子占用2个格子.最后一个把剩下的都占用了.假设问题有解.这样做一定有解.其它策略就 ...

  4. mongoose中的versionKey

    通过mongoose中的save方法保存记录时document文档默认最后会有一个字段"__v",这个字段表示该文档是否是刚刚创建的,如果是则字段"__v"的值 ...

  5. 日期时间函数(1)-time()&gmtime()&strftime()&localtime()

    ◆time() 取得当前时间.此函数会返回从公元1970年1月1日的UTC时间从0时0分0秒算起到现在所经过的秒数.如果参数t为非空指针的话, 此函数也会将返回值存到t指针所指的内存. 成功则返回秒数 ...

  6. 李洪强iOS开发之-FMDB的用法

    // //  ViewController.m //  04 - FMDB的用法 // //  Created by 李洪强 on 2017/6/6. //  Copyright © 2017年 李洪 ...

  7. Oracle PLSQL Demo - 01.定义变量、打印信息

    declare v_sal ) :; begin --if you could not see the output in console, you should set output on firs ...

  8. mac下borderless的window(无标题栏)如何实现

    子类化NSWindow: - (void)awakeFromNib { [selfsetStyleMask:NSBorderlessWindowMask]; [selfsetAcceptsMouseM ...

  9. 如何读取jar包外的properties文件和log4j.properties

    http://jrails.iteye.com/blog/1705464 ***************************************' 一般在项目中使用properties配置文件 ...

  10. Python 下载excel

    上面源码 View:result_list是一个list为数据,当为list时,用enumerate可以获取到list的值和值所在序号 xlsx = openpyxl.Workbook() table ...