BBC BASIC for Windows
« Memory Limit »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:09pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Memory Limit  (Read 1290 times)
mohsen
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 39
xx Memory Limit
« Thread started on: Nov 5th, 2008, 1:22pm »

What is the reason that memory is limited to about 256 Mb? i.e. cannot raise HIMEM above 255 Mb.

Thanks


User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Limit
« Reply #1 on: Nov 5th, 2008, 4:12pm »

Quote:
What is the reason that memory is limited to about 256 Mb?

It's largely arbitrary. The maximum theoretical (2^n) amount of memory it's possible to allocate under Windows is 1 Gbyte, but it didn't seem appropriate to push it right to the limit. When running under Wine, it can't always even manage to allocate the 256 Mbytes.

There's also some positive value in leaving a substantial amount of process memory space not reserved by BB4W, so you can allocate it using the Windows API. If BB4W had grabbed the lot, it would restrict your use of functions like CreateFileMapping (I presume you appreciate that BB4W must 'reserve' all the address space it might ever need at the start; it can't add to the reservation later, because the memory might have become fragmented).

How does the 256 Mbyte limit restrict you, in a way that can't easily be overcome using (for example) the technique described at http://bb4w.wikispaces.com/Allocating+arrays+using+the+Windows+API?

Richard.
User IP Logged

mohsen
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 39
xx Re: Memory Limit
« Reply #2 on: Nov 5th, 2008, 5:03pm »

on Nov 5th, 2008, 4:12pm, Richard Russell wrote:
It's largely arbitrary. The maximum theoretical (2^n) amount of memory it's possible to allocate under Windows is 1 Gbyte, but it didn't seem appropriate to push it right to the limit. When running under Wine, it can't always even manage to allocate the 256 Mbytes.

There's also some positive value in leaving a substantial amount of process memory space not reserved by BB4W, so you can allocate it using the Windows API. If BB4W had grabbed the lot, it would restrict your use of functions like CreateFileMapping (I presume you appreciate that BB4W must 'reserve' all the address space it might ever need at the start; it can't add to the reservation later, because the memory might have become fragmented).

How does the 256 Mbyte limit restrict you, in a way that can't easily be overcome using (for example) the technique described at http://bb4w.wikispaces.com/Allocating+arrays+using+the+Windows+API?

Richard.



It does not restrict me as I use the HeapCreate API for anything larger than 1Mb. I just came across it when doing some tests with the program.

I just wanted to know the reason behind it.

Now I know, as you said, It's largely arbitrary number. If we are living 10 years from now in the future it could have been 16 Gb. grin

Suggestion:

Why don't you leave the programmer decide the size without giving him/her the restrictions, you only need to give guidance and suggestions/warning. The programmer is responsible for its programmes.

Another question:

Why, as you stated, the maximum theoretical amount of memory possible to allocate under Windows is 1 Gbyte? Is this BB4W limit. I thought Windows limits is 2Gb per 32_bit application.


Cheers
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Limit
« Reply #3 on: Nov 5th, 2008, 10:48pm »

Quote:
Why don't you leave the programmer decide the size without giving him/her the restrictions

It's not straightforward. As I explained, BB4W has to 'reserve' the address space at the very start, when the IDE is initialised - before the user's program is even loaded, let alone run. If the programmer were given the ability to change the amount reserved, it could only be 'per session', not per program. The only way to change the value would be to quit BB4W entirely and restart it, which is not very satisfactory.

So if the user happened to be working on two different programs, one which needed HIMEM to be much higher than 256 Mbytes, and another which made extensive use of memory allocation from Windows (e.g. GlobalAlloc or a memory-mapped file) there could be a conflict. He might not be able to work on both programs in the same session.

Quote:
Why, as you stated, the maximum theoretical amount of memory possible to allocate under Windows is 1 Gbyte?

I said that the maximum 2^n amount of memory is 1 Gbyte, which is different. When a Windows application is loaded, the executable itself uses up some of the 2 Gbytes available for the user. Also, low memory (the bottom 64 Kbytes) is reserved and cannot be used by the user program. Hence, it is impossible to reserve 2 Gbytes of address space, and the next smaller power-of-two amount of memory is 1 Gbyte.

There's no fundamental reason why BB4W needs to reserve 2^n bytes, but it seems sensible.

In case you're not aware, I feel I should give you a bit of background to the development of BB4W. It was initially released in 2001, and underwent a rapid expansion, with the addition of many new features, until around 2006. After that development slowed, partly because I lost enthusiasm for it, partly because as I got older I was acutely aware of my 'waning powers' (I found myself making more and more silly mistakes) and partly because I craved the stability of the old, ROM-based, versions of BBC BASIC!

Therefore a year or so ago I announced that active development of BB4W would cease, to be replaced by a 'maintenance' phase in which the only changes would be bug fixes and the possible incorporation of simple additions which could be done at low risk. I also decided to 'freeze' the size of the run-time engine, so that any alterations to the interpreter would be conditional on not making it any bigger.

So you will appreciate that my reaction to suggestions of significant alterations/additions is likely to be very different to what it might have been five years ago! My main concerns now are that BB4W should be as stable and bug-free as possible, not to add new features.

Richard.
User IP Logged

mohsen
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 39
xx Re: Memory Limit
« Reply #4 on: Nov 6th, 2008, 10:27am »

Thanks Richard for the information.

It is sad to know that the development of BB4W has stopped.

Considering that you are getting old, may be you should seriously consider selling the application to another source who will agree to maintain it and develop it (keeping the olf BBC BASIC spirit).

You have a good interpreter engine that is d**n fast and tight on code. Nothing there I could see in future that would need change, but maybe updates to take care of new feature/compatibility that would come in future Windows applications (Windows 7, 8.. etc.) and new CPUs.

This however cannot be said about the IDE for which continuing development and feature additions would be necessary.

I had in mind a list of improvement items for the IDE, but now this would be unnecessary.

Cheers.

User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Limit
« Reply #5 on: Nov 6th, 2008, 2:23pm »

Quote:
It is sad to know that the development of BB4W has stopped.

I actually see it as a positive thing. I'd far rather concentrate on using it than developing it. However beneficial a change might be, it always risks bugs being introduced, and often there are unavoidable incompatibilities.

A few people have told me that they wouldn't consider using BB4W unless it had remained unchanged for several months, because more frequent updates (which is what used to happen) left them uneasy about the product's stability.

Quote:
may be you should seriously consider selling the application to another source who will agree to maintain it and develop it

I'm not sure how practical that would be. Certainly nobody's ever approached me with any serious proposal of that kind.

BBC BASIC is now about 27 years old. It's pretty remarkable that it's in such good shape after all that time, but perhaps it should be allowed a quiet retirement!
User IP Logged

Trevor
Guest
xx Re: Memory Limit
« Reply #6 on: Apr 16th, 2009, 12:37pm »

Perhaps the best route for BBC basic is for it to go back to its origins in the Education system.

As a teacher I put many years into developing software based on this system for my school, before the advent of commercial programmes.

As Richard has developed such a useful programming language I was wondering one of the universities or the science Museum might want to take over as guardians of such an important development and historical resource.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Limit
« Reply #7 on: Apr 16th, 2009, 9:54pm »

Quote:
I was wondering one of the universities or the science Museum might want to take over as guardians of such an important development and historical resource.

The Science Museum is certainly well aware of the historical importance of BBC BASIC, and it was they who hosted the BBC Micro and its Legacy event last year:

http://www.computerconservationsociety.org/20080320.htm

However nobody there has ever suggested to me that they might want to take on the more practical 'conservation' role that you suggest.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls