This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

GraphicsDevice.getAvailableAcceleratedMemory() question.  RSS feed

 
Quazi Irfan
Ranch Hand
Posts: 104
1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to see the available video memory by calling GraphicsDevice.getAvailableAcceleratedMemory(), but it's returning me -1,048,576. I am using nVidia GT 750 and it has a 2GB of dedicated and 4GB of shared video memory.

I looked into JDK source, and the source of this method is even more puzzling. It simply returns -1.


Why the negative value, and why, in the source, this method is returning -1?

-
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The comments above the method say, A negative return value indicates that the amount of accelerated memory on this GraphicsDevice is indeterminate.
 
Quazi Irfan
Ranch Hand
Posts: 104
1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doh! My bad. Thanks.

But why in the source the return value is set to -1?
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The source you posted is for an abstract class. That method is supposed to be overridden. See here for the implementation.
 
Quazi Irfan
Ranch Hand
Posts: 104
1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!