English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 03 September 2012, 22:43   #1
Wepl
Moderator
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 684
CreatePool MEMF_FAST

maybe somebody will fail with same approach like me, used:
Code:
exec.CreatePool(MEMF_FAST,a,b)
and expected this will fail on a machine with chip ram only.
but no - this succeeds. you will get a memory pool which is unable to allocate any memory. because the pool structure is allocated with MEMF_ANY! all subsequent allocations in the pool are tried with MEMF_FAST.
Wepl is offline  
Old 03 September 2012, 23:17   #2
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 856
well, since the pool is grown dynamically, no memory is probably allocated before the first AllocPooled is called, and therefore CreatePool never even discovers that the system has no fastmem.. This may or may not appear stupid, depending on how you look at it..

the attributes used for allocating the pool structure itself rightfully has nothing to do with the memflags argument given to CreatePool..
hooverphonique is offline  
Old 05 September 2012, 01:30   #3
Wepl
Moderator
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 684
yes, but but was it returns under my conditions is useless.
Wepl is offline  
Old 05 September 2012, 17:00   #4
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 667
Quote:
Originally Posted by Wepl View Post
maybe somebody will fail with same approach like me, used:
Code:
exec.CreatePool(MEMF_FAST,a,b)
and expected this will fail on a machine with chip ram only.
but no - this succeeds. you will get a memory pool which is unable to allocate any memory. because the pool structure is allocated with MEMF_ANY! all subsequent allocations in the pool are tried with MEMF_FAST.
Sound strange. If I understand correctly exec.AllocMem(a, MEMF_FAST) fails on that machine, right ?
Asman is offline  
Old 05 September 2012, 17:08   #5
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,209
Quote:
Originally Posted by Asman View Post
If I understand correctly exec.AllocMem(a, MEMF_FAST) fails on that machine, right ?
Of course it will fail on a chipram only machine.

As for CreatePool, to me it somehow makes sense that it doesn't fail. Because all it does it allocating memory for the pool. And AllocPooled will later fail anyway if you try to alloc fast mem. So I don't really see a problem here.
StingRay is online now  
Old 05 September 2012, 17:42   #6
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,783
What's the reason for using MEMF_FAST? Fast RAM is preferred anyway so MEMF_ANY should serve well on a machine with Fast RAM as well as on a machine without.
thomas is offline  
Old 05 September 2012, 17:45   #7
Wepl
Moderator
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 684
because I don't want use memory pools on a machine which has no fast memory
Wepl is offline  
Old 05 September 2012, 17:56   #8
Wepl
Moderator
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 684
Quote:
Originally Posted by StingRay View Post
As for CreatePool, to me it somehow makes sense that it doesn't fail. Because all it does it allocating memory for the pool. And AllocPooled will later fail anyway if you try to alloc fast mem. So I don't really see a problem here.
typical answer of a programmer
I understand too why it is working that way.
From the customer point of view it simply does not deliver what it promises. It tells it can deliver fast mem and will never be able to do so.
Wepl is offline  
Old 05 September 2012, 17:59   #9
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,209
I guess it really depends on how you look at it. I would have expected CreatePool to fail too if you request fast mem for the pool on a chip only machine. On the other hand I can perfectly understand why it successfully creates the pool. :P

But I think it's better to use other approaches to check for fast mem anyway.
StingRay is online now  
Old 17 January 2019, 16:28   #10
BastyCDGS
Registered User
 
Join Date: Nov 2015
Location: Freiburg / Germany
Age: 39
Posts: 68
Send a message via ICQ to BastyCDGS
Hi!



Quote:
Originally Posted by StingRay View Post
I guess it really depends on how you look at it. I would have expected CreatePool to fail too if you request fast mem for the pool on a chip only machine. On the other hand I can perfectly understand why it successfully creates the pool. :P

But I think it's better to use other approaches to check for fast mem anyway.

Just curious, but is it possible to hotplug fast memory on (certain) Amiga(s)? In that case, the AllocPooled call would be successful if you hotplug some fast RAM after CreatePool has been called.

BTW, what happens if you do a AllocPooled with 0 bytes with MEMF_FAST? Does it fail, too? If yes, you could use that to check whether there is really some fast memory available.
BastyCDGS is offline  
Old 17 January 2019, 17:43   #11
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,209
Quote:
Originally Posted by BastyCDGS View Post
BTW, what happens if you do a AllocPooled with 0 bytes with MEMF_FAST? Does it fail, too?
It doesn't fail.

Quote:
Originally Posted by BastyCDGS View Post
If yes, you could use that to check whether there is really some fast memory available.
There are better/easier ways to check if fast memory is available.
StingRay is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:49.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.11015 seconds with 14 queries