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 => ...
随机推荐
- [转]Windows 7自带很好用的磁盘检查与修复的环境
大家可能都知道Windows 7自带很好用的检查与修复的环境.在启动系统前按F8(就是进入安全模式的方法),Windows 7会有一个修复计算机的选项.选择进入,装载一些必要的文件之后,选择语言.登陆 ...
- NUMA体系结构详解
1. NUMA的几个概念(Node,socket,core,thread) 对于socket,core和thread会有不少文章介绍,这里简单说一下,具体参见下图: 一句话总结:socket就是主板上 ...
- 2015小米暑期实习笔试题_风口的猪-中国牛市(dp)
风口之下.猪都能飞.当今中国股市牛市,真可谓"错过等七年". 给你一个回想历史的机会,已知一支股票连续n天的价格走势,以长度为n的整数数组表示,数组中第i个元素(prices[i] ...
- TinyXml 操作XML 常用操作
源代码下载:http://sourceforge.net/projects/tinyxml/files/ 如下是一个XML片段: <Persons> <Perso ...
- ISE和Modelsim联合仿真(详细步骤讲解)
ISE和Modelsim联合仿真(转) 地址:http://www.cnblogs.com/feitian629/archive/2013/07/13/3188192.html 相信很多人会遇到过这个 ...
- 每日英语:Does Evolution Want Us To Be Unhappy?
Samuel Johnson called it the vanity of human wishes, and Buddhists talk about the endless cycle of d ...
- 将Java项目从maven迁移到gradle
将Java项目从maven迁移到gradle 如何将一个java项目从maven迁移到gradle呢?gradle集成了一个很方便的插件:Build Init Plugin,使用这个插件可以很方便地创 ...
- Markdown: Basics (快速入门)[转]
Markdown: Basics (快速入门) / (点击查看完整语法说明) Getting the Gist of Markdown's Formatting Syntax [转自:http://w ...
- POJ1579:Function Run Fun
Description We all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c ...
- FreeRTOS 低功耗之停机模式
以下转载自安富莱电子: http://forum.armfly.com/forum.php STM32F103 如何进入停机模式在 FreeRTOS 系统中,让 STM32 进入停机模式比较容易,调用 ...