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. python dataframe 在merge时 产生笛卡尔积

    在pandas中,concat, merge, join的使用方法可以参考以下资料: http://blog.csdn.net/stevenkwong/article/details/52528616 ...

  2. Linux中telnet命令

    telnet命令通常用来远程登录.telnet程序是基于TELNET协议的远程登录客户端程序.Telnet协议是TCP/IP协议族中的一员,是Internet远程登陆服务的标准协议和主要方式.它为用户 ...

  3. session和cookie的联系

    前提: 一.cookie机制 正统的cookie分发是通过扩展HTTP协议来实现的,服务器通过在HTTP的响应头中加上一行特殊的指示以提示浏览器按照指示生成相应的cookie.然而纯粹的客户端脚本如J ...

  4. vim-snipmate的c.snippets(2016.7.10)

    ## Main # main snippet main int main ( void ) { ${} ; } ##include snippet inc #include <${:stdio} ...

  5. 无线路由器硬件配置參数 NetGear篇

    NetGear     WNDR4500(号称地球上最强的无线路由器)    450Mbps+450Mbps          京东¥1399 0MHz.配备了128MB的内存和128MB的闪存,再以 ...

  6. 【转】32位和64位系统区别及int字节数

    http://blog.csdn.net/zhongzhiwei/article/details/8678885 一)64位系统和32位有什么区别? 1.64bit CPU拥有更大的寻址能力,最大支持 ...

  7. VC++ 进度条的使用

    进度条控件封装在CProcessCtrl类中 1.SetRange和SetRange32方法来设置进度条显示范围. 语法格式: void SetRange(short nLower, short nU ...

  8. Python实现二叉树及其4种遍历

    Python & BinaryTree 1. BinaryTree (二叉树) 二叉树是有限个元素的集合,该集合或者为空.或者有一个称为根节点(root)的元素及两个互不相交的.分别被称为左子 ...

  9. sql增删改查封装

    App.config文件 <?xml version="1.0" encoding="utf-8" ?> <configuration> ...

  10. iOS网络NSURLSession使用详解

    一.整体介绍 NSURLSession在2013年随着iOS7的发布一起面世,苹果对它的定位是作为NSURLConnection的替代者,然后逐步将NSURLConnection退出历史舞台.现在使用 ...