kevinfishburne ha scritto: > Using GAMBAS 2.19 I tried creating an array: > > PUBLIC Elevation AS Short[65536, 65536] > > With no data assigned to any of the array's elements, reading Elevation[0,0] > shows a value of 24. I'm thinking it should be zero. Reading > Elevation[4095,0] crashes the program. I tried reading Elevation[100,100] > from the debug window and it also crashes the program. > > Granted this array if fully allocated would consume 8 gigabytes of RAM. My > system has 4 gigs of RAM and an 8 gig swap file. Does GAMBAS use the swap > file if enough physical RAM isn't available? What are the size constraints > of arrays? Why would Elevation[0,0] show up as 24 when Elevation[1,1], etc., > are zero as they should be? > Probably there is some bug here, but anyway I would use some other mean to achieve the goal.
This data take 4 Gib cells, each 2 bytes (bytes?) wide, for 8 Gib total. But if this is a dynamic array, there is the pointer to each cell to consider: 4 bytes for every cell on 32 bit systems, and probably 8 bytes for 64 bit systems; it leads to 4 Gcells * 6 bytes, (24 gigabytes), or 40 Gib on 64 bit systems. If you really have 65536*65536 cells, all alive together, you could use a binary file on disk. Disk caching will speed up things, perhaps better than fake ram swapped in/out from disk. If you don't have all the cells live together, you could use an association, and only keep in ram the cell along with its "coordinates". A database could also make sense. If you insist on the ram approach, then a static array would consume less memory, if it is still supported. This is an unauthoritative thought. Regards, Doriano ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
