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. C#--索引

    索引是一组get和set访问器,类似于属性的访问器. 索引和属性在很多方面是相似的. 和属性一样,索引不用分配内存来存储: 索引和属性都主要被用来访问其他数据成员,这些成员和他们关联,他们为这些成员提 ...

  2. Hadoop启动过程分析

    先把客户端修好,后续慢慢写.  菊子曰:体验离线写博的乐趣

  3. Diamond 3.5简易教程(一)------工程的建立

    测试环境(win10 x64 软件Diamond 3.5 x64) 软件下载地址:http://files.latticesemi.com/Diamond/3.5/3.5.0.102_Diamond_ ...

  4. 配置 logrotate 指导

    一般来说,日志是任何故障排除过程中非常重要的一部分,但这些日志会随着时间增长.在这种情况下,我们需要手动执行日志清理以回收空间,这是一件繁琐的管理任务.为了解决这个问题,我们可以在 Linux 中配置 ...

  5. nfs missing codepage or helper program, or other error

    [root@xxxxx ~]# /bin/mount -t nfs -o nosuid,noexec,nodev,noatime,intr,rsize=,wsize= xxx.xxx.xxx.xxx: ...

  6. android笔记一 控件属性

    <?xml version = "1.0" encoding = "utf-8"?> <LinearLayout xmlns:android= ...

  7. Parallel Programming AND Asynchronous Programming

    https://blogs.oracle.com/dave/ Java Memory Model...and the pragmatics of itAleksey Shipilevaleksey.s ...

  8. 从INT 到STRING的几种方法

    1.   int sprintf( char *buffer, const char *format [, argument] ... );      <stdio.h>例如: int s ...

  9. LeetCode: Maximal Rectangle 解题报告

    Maximal RectangleGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle contai ...

  10. git学习(三):git暂存区

    回顾之前学过的命令: git init // 初始化一个项目 git add // 将文件交给工作区 git commit // 提交修改 查看提交日志: git log // 查看提交日志 git ...