e673. Getting Amount of Free Accelerated Image Memory
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的更多相关文章
- SAP work process Memory allocate
Memory allocation sequence to dialog work processes in SAP What is the memory allocation sequence to ...
- PatentTips – GPU Saving and Restoring Thread Group Operating State
BACKGROUND OF THE INVENTION The present invention relates generally to single-instruction, multiple- ...
- Reactor by Example--转
原文地址:https://www.infoq.com/articles/reactor-by-example Key takeaways Reactor is a reactive streams l ...
- nginx_mysql_redis配置
#Nginx所用用户和组,window下不指定 #user nobody; #工作的子进程数量(通常等于CPU数量或者2倍于CPU) worker_processes 2; #错误日志存放路径 #er ...
- redis配置详解
##redis配置详解 # Redis configuration file example. # # Note that in order to read the configuration fil ...
- 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 ...
- Redis(一) 介绍
先说明下,本人是在windows系统下用的. 简单介绍一下,是nosql数据库,采用key-value存储方式形式.可用于处理高并发日志.维护top表等. 如果把它完全当初数据库使用,当做小型数据库还 ...
- Redis 配置文件
# Redis configuration file example. # # Note that in order to read the configuration file, Redis mus ...
- Redis 配置文件详解
# Redis 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, 5GB, 4M 等类似的格式,其转换方式如下(不区分大小写)## 1k => 1000 bytes# 1kb => ...
随机推荐
- .net利用SQLBulkCopy进行数据库之间的大批量数据传递
SQLBulkCopy,用于数据库之间大批量的数据传递.通常用于新,旧数据库之间数据的更新.即使表结构完全不同,也可以通过字段间的对应关系,顺利的将数据导过来. 首先,SQLBulkCopy需要2个连 ...
- stm32 spi1 bug
stm32 spi1调试NRF24L01时该模块作为接收机时,能收到数据,作为发送机时,发不出数据(虽然读NRF的寄存器显示数据已经发出,但实际并发不出),换到SPI2问题解决
- 使用Xfire发布WebService接口遇到的问题:
问题一: log4j:WARN No appenders could be found for logger (org.codehaus.xfire.transport.DefaultTranspor ...
- pandas 按照某一列进行排序
pandas排序的方法有很多,sort_values表示根据某一列排序 pd.sort_values("xxx",inplace=True) 表示pd按照xxx这个字段排序,inp ...
- python标准库介绍——3 stat 模块详解
== stat 模块 == [Example 1-50 #eg-1-50] 展示了 ``stat`` 模块的基本用法, 这个模块包含了一些 ``os.stat`` 函数中可用的常量和测试函数. === ...
- JavaScript与DOM(上)
本来像自己写一篇的...结果看到了Tom uncle的这篇..总结的确实很赞,其他文章也非常好推荐 转载自:http://www.cnblogs.com/TomXu/archive/2011/12/1 ...
- dubbo-admin 管理台的部署
首先上传dubbo-admin的war包 参考链接: http://www.open-open.com/lib/view/open1454043410245.html
- storm配置:如何解决worker进程内存过小的问题
问题导读1.如何设置storm内存?2.如果没有配置文件的情况下,该如何配置一些参数?3.通过哪个参数可以配置内存? Storm中真正干活的是各个worker,而worker由supervisor负责 ...
- 网络编程之TCP/UDP及其流程比较(转)
TCP与UDP的区别 基于连接与无连接 对系统资源的要求(TCP较多,UDP少) UDP程序结构较简单 流模式与数据报模式TCP保证数据正确性,UDP可能丢包TCP保证数据顺序,UDP不保证 具体编程 ...
- Java中instanceof关键字的理解
java 中的instanceof 运算符是用来在运行时指出对象是否是特定类的一个实例.instanceof通过返回一个布尔值来指出,这个对象是否是这个特定类或者是它的子类的一个实例. 用法: res ...