a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 exec.library
  AVL_AddNode
  AVL_FindFirstNode
  AVL_FindLastNode
  AVL_FindNextNodeByAddress
  AVL_FindNextNodeByKey
  AVL_FindNode
  AVL_FindPrevNodeByAddress
  AVL_FindPrevNodeByKey
  AVL_RemNodeByAddress
  AVL_RemNodeByKey
  AbortIO
  AddDevice
  AddHead
  AddIntServer
  AddLibrary
  AddMemHandler
  AddMemList
  AddPort
  AddResource
  AddSemaphore
  AddTail
  AddTask
  Alert
  AllocAbs
  AllocEntry
  AllocMem
  AllocPooled
  AllocSignal
  AllocTrap
  AllocVec
  Allocate
  AttemptSemaphore
  AttemptSemaphoreShared
  AvailMem
  CacheClearE
  CacheClearU
  CacheControl
  CachePostDMA
  CachePreDMA
  Cause
  CheckIO
  CloseDevice
  CloseLibrary
  ColdReboot
  CopyMem
  CopyMemQuick
  CreateIORequest
  CreateMsgPort
  CreatePool
  Deallocate
  Debug
  DeleteIORequest
  DeleteMsgPort
  DeletePool
  Disable
  DoIO
  Enable
  Enqueue
  FindName
  FindPort
  FindResident
  FindSemaphore
  FindTask
  Forbid
  FreeEntry
  FreeMem
  FreePooled
  FreeSignal
  FreeTrap
  FreeVec
  GetCC
  GetMsg
  InitCode
  InitResident
  InitSemaphore
  InitStruct
  Insert
  MakeFunctions
  MakeLibrary
  ObtainQuickVector
  ObtainSemaphore
  ObtainSemaphoreList
  ObtainSemaphoreShared
  OldOpenLibrary
  OpenDevice
  OpenLibrary
  OpenResource
  Permit
  Procure
  PutMsg
  RawDoFmt
  ReleaseSemaphore
  ReleaseSemaphoreList
  RemDevice
  RemHead
  RemIntServer
  RemLibrary
  RemMemHandler
  RemPort
  RemResource
  RemSemaphore
  RemTail
  RemTask
  Remove
  ReplyMsg
  SendIO
  SetExcept
  SetFunction
  SetIntVector
  SetSR
  SetSignal
  SetTaskPri
  Signal
  StackSwap
  SumKickData
  SumLibrary
  SuperState
  Supervisor
  TypeOfMem
  UserState
  Vacate
  Wait
  WaitIO
  WaitPort
Include
GuruMeditation
Docs » Autodocs » exec.library » FreePooled

NAME

	FreePooled -- Free pooled memory  (V39)

SYNOPSIS

	FreePooled(poolHeader,memory,memSize)
a0 a1 d0
void FreePooled(void *,void *,ULONG);

FUNCTION

	Deallocates memory allocated by AllocPooled().  The size of the
allocation *MUST* match the size given to AllocPooled().
The reason the pool functions do not track individual allocation
sizes is because many of the uses of pools have small allocation
sizes and the tracking of the size would be a large overhead.
Only memory allocated by AllocPooled() may be freed with this
function!
Doing a DeletePool() on the pool will free all of the puddles
and thus all of the allocations done with AllocPooled() in that
pool. (No need to FreePooled() each allocation)

INPUTS

	memory - pointer to memory allocated by AllocPooled.
poolHeader - a specific private pool header.

NOTES

	The pool function do not protect an individual pool from
multiple accesses. The reason is that in most cases the pools
will be used by a single task. If your pool is going to
be used by more than one task you must Semaphore protect
the pool from having more than one task trying to allocate
within the same pool at the same time. Warning: Forbid()
protection *will not work* in the future. *Do NOT* assume
that we will be able to make it work in the future. FreePooled()
may well break a Forbid() and as such can only be protected
by a semaphore.
To track sizes yourself, the following code can be used:
Assumes a6=ExecBase
;
; Function to do AllocVecPooled(Pool,memSize)
;
AllocVecPooled: addq.l #4,d0 ; Get space for tracking
move.l d0,-(sp) ; Save the size
jsr _LVOAllocPooled(a6) ; Call pool...
move.l (sp)+,d1 ; Get size back...
tst.l d0 ; Check for error
beq.s avp_fail ; If NULL, failed!
move.l d0,a0 ; Get pointer...
move.l d1,(a0)+ ; Store size
move.l a0,d0 ; Get result
avp_fail: rts ; return
;
; Function to do FreeVecPooled(pool,memory)
;
FreeVecPooled: move.l -(a1),d0 ; Get size / ajust pointer
jmp _LVOFreePooled(a6)

SEE ALSO

AllocPooled(), CreatePool(), DeletePool()

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Anarchy

PDX
ANA
TSL
ATX

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se