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 => ...
随机推荐
- WinForm开发,窗体显示和窗体传值相关知识总结
主窗体中代码: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void b ...
- cocos2dx 3.3多相机下_transformUpdated bug
uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags) { if(_using ...
- session和cookie的联系
前提: 一.cookie机制 正统的cookie分发是通过扩展HTTP协议来实现的,服务器通过在HTTP的响应头中加上一行特殊的指示以提示浏览器按照指示生成相应的cookie.然而纯粹的客户端脚本如J ...
- TreeView 高速单击时不运行AfterCheck时间
解决方法1: 在AfterCheck事件中,通过System.Threading.Thread.Sleep()来控制函数的运行的最短时间.保证函数运行时间必须大于某个值 解决方法2: 编写列TreeV ...
- Python框架级编程的能力要求
说在前面:比较基础的就不说 1.装饰器熟练掌握 2.内建函数,内建变量.下划线函数之类的东西要搞明白 3.一定Python数据接口和算法实现能力 4.内省 5.元编程
- 每日英语:A New Recipe for Innovation That Feeds the Whole Organization
The world is a fast and dangerous place. To survive a company must innovate. Many organizations look ...
- ny42 一笔画问题
一笔画问题 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来. ...
- SpringKafka消费端配置类ConsumerConfig.java源码
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. ...
- Zookeeper的Quorum机制-谈谈怎样解决脑裂(split-brain)
在使用zookeeper的过程中,我们经常会看到这样一些说法: 1.zookeeper cluster的节点数目必须是奇数. 2.zookeeper 集群中必须超过半数节点(Majority)可用,整 ...
- Qt学习之路2---窗口组件及窗口类型
窗口组件: 图形用户界面由不同的窗口和窗口组件构成: Qt以组件对象的方式,构建图形用户界面. 组件的类型包括: ---容器类(父组件):用于包含其他的界面组件 ---功能类(子组件):用于实现特定的 ...