Codebench problem

6 posts / 0 new
Last post
jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 week ago
Joined: 2019-04-13 19:29
Codebench problem

I'm using Codebench on a large project. After a few minutes a window pops up with the following message:

"The amount of free memory is now below 10MB. You should save your work and quit."

I click Okay and it goes away and then after 30 seconds or so, it comes back. It makes it pretty much unusable. It's nonsense of course, because 10 MB is plenty of memory. My micro has 256 GB of memory. I increased the stack on the Codebench icon to 200000, it didn't help. I'm using the license-free version. I'm wondering if there is a fix for this. Or I'd like to know how you can buy a licensed version. I went to the Codebench.uk web site and I couldn't see how to buy it.

I'm using OS4.1 FE Update 1.

jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 week ago
Joined: 2019-04-13 19:29
Re: Codebench problem

Oops! My micro actually has 256 MB RAM, and when I start getting this message I really do have less than 10 MB of RAM. So the solution to this "problem" is to free up some memory. That is doable.

hypex
hypex's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-09-09 16:20
Re: Codebench problem

That is rather low. And not just the 10MB! Does the micro take up to 2GB? Quarter gig is really small now days. I'd see if you can locate 2GB replacement. Or 1GB even. If you want to develop on it you need RAM.

Rigo
Rigo's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2011-01-24 21:55
Re: Codebench problem

So it isn't really a CodeBench problem, more an alert that CodeBench has detected a low memory situation and informed you of the problem...

.Thanks CodeBench :)

jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 week ago
Joined: 2019-04-13 19:29
Re: Codebench problem

Not only am I getting this message from Codebench, my project started crashing every time. I'm using big 32-bit bitmaps. They're actually 24-bit, but the memory is allocated as 32-bit. I don't check memory every time I load an image from disk. I know that is bad, but it gets cumbersome. It's easier to make assumptions about how much memory is available. I checked things over and over. It isn't bad to triple-check things. I thought maybe I was accidently using 16-bit integers for pointers. But I found out in PPC systems all integers are 32-bit unless you specify otherwise. I couldn't find any problems. Then I ran the project on my X5000, which I can't use because it has debug problems. It has 2 GB ram. The project starts up every time without a problem. So I will have to increase the RAM in my micro. It has one memory slot. I could go to 512 MBs, that would double the memory. I'm wondering if anyone has tried a 1-GB RAM module in a micro.

hypex
hypex's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-09-09 16:20
Re: Codebench problem

The micro will be limited with 32MB graphics RAM IIRC. It may be possible to use a graphics card in the slot provided. I think you can but it may limit storage device access.

The 32-bit would be correct as the pixels would be in ARGB with an alpha channel. That and since 24 bits doesan't fit into normal alignment it needs 32-bpp. Regardless of your source.

I'm afraid the Amiga way is checking allocations. There is no free resource tracking. Some limited tracking exists for some system objects but you have to specify it. Cumbertsome perhaps but without it you will have buggy code that only works in normal conditions. Also OOP isn't exactly part of the OS design. They tried it with datatypes and BOOPSI but they kinda hacked it onto a non-OOP API model.

AmigaE is useful as you can set up exceptions for OS functions so if it fails it automatically terminate into a handler. You then need to free the resources in the handler in the obligatory reverse order. I duplicated it in C but with manual control. So if an alllocation fails I call an Error() routine. This then frees all resouces, prints an error message and quits. I use the C exit() function to exit. So you will need something. More work maybe but you could consider a linked list or even an object containing a list all named resources, types and pointers, Then run through the list, store the pointers and loaded assets. On fail just walk the list and free it. Easier with a type you put in a case statement and use with open and close code for that type. I did something similar when I was putting a game framework together, but didn't finish the game code. :-)

Log in or register to post comments