Result of Dim

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.

Hello again!

I think this topic does allready exists from the past. did not know.
What I would like to see is:

That Dim gives back a result if there is not enough memory for it. In my applications I need huge dimensions and its possible not enough memory there so PB only crashes. not realy nice.
So, how could I check this or is it possible to implement this in the Dim Command?

Mike

Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User
System: Windows 2000 Server, 512 MB Ram, GeForce4200 TI 128 MB DDR, Hercules Theater 6.1 DTS Sound
System 2: Mobile Pentium 4 2.4GHz 512 MB DDR GeForce4 420-32, Windows XP Home
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by vanleth.

I wouldn't use Dim in large memory allocations. Think it's out of scope for the Dim command. Prefer to use AllocateMemory() and make my own routines to fetch data arraywise

Else try calc the memory size of the Dim and do a ruff check with the win32 API GlobalMemoryStatus.

Code: Select all

MS.MEMORYSTATUS

MS\dwLength = SizeOf(MEMORYSTATUS)
GlobalMemoryStatus_(@MS)
Debug "Avail mem: "+Str(MS\dwAvailPhys)

end
[edit]Forgot to finish a sentence[/edit]
Post Reply