Memory Access Violation - Too much of something?


👉 BlitzCoder will be building a new platform and other plans to preserve and continue the Blitz legacy.

To be able to achieve this goal, we need your support by becoming a Patreon Paid Member 👈

 

Tweet
Octan

The following code is giving me a Memory Access Violation error as known as MAV error.
Either the number of pointers is too excessive or the memory is full ? No RAM bottleneck in the task manager though....

How to solve this problem ?

```blitzbasic
; Define the CHAIR Type

Type CHAIR
Field X
Field Y
Field HEIGHT
End Type

; Create 8000*8000 = 64 000 000 new chairs using FOR ... NEXT using the collection name of ROOM

For tempx = 1 To 8000
For tempy = 1 To 8000
room.chair = New Chair
room\x = tempx
room\y = tempy
room\height = Rnd(0,10) ; set a random height 0 to 10
Next
Next

```

RasterRon commented:

Too much of something?

That's 64 Million objects so yes, try not to allocate or use too much objects with Blitz3D.

RemiD commented:
Graphics(854,480,32,2)

Global chairscount%
Type Tchair
 Field x
 Field y
 Field height
End Type

For tempx = 1 To 7000
 For tempy = 1 To 7000
  chairscount = chairscount + 1
  chair.Tchair = New Tchair
  chair\x = tempx
  chair\y = tempy
  chair\height = Rnd(0,10) ; set a random height 0 to 10
 Next
Next

;DebugLog( chairscount )
Print( chairscount )

WaitKey()

End()

this works on my side with 7000 x 7000 instances, but 8000 x 8000 instances produces an error message (memory access violation) also.

but why would you need so many instances ? 64 000 000 !!!

Octan commented:

Thanks @RemiD and @RasterRon !

but why would you need so many instances ? 64 000 000 !!!

I was doing some testing with objects size and number! With "loaded/heavy" instances , I can't go up to 64 000 000 instances.

Do you know how to check the size in memory of those instances ? Or maybe the available space in memory after and before creating the instances ?

Thanks!

fox95871 commented:

Believe it or not, those 'too much' moments can happen with Blitz3d. That's why I use a bottom of the line computer - that, and I'm poor - because it helps to know that anything my computer can handle, most likely anyone elses can. The kind of testing you're doing is conscientious, but take it slow... approach the limits you want to know exist a little at a time, not a zillion.

This is a bit off topic, but I once did similar testing on high decimal values for highly specific positioning of vertexes, and found that keeping everything within the -X.XXXXX through +X.XXXXX range is best, because a sixth decimal place would get averaged, since the decimal point, and even the + and - signs get counted as part of the 8 character limit.

Reply To Topic (minimum 10 characters)

Please log in to reply