Mac-Carbon
view release on metacpan or search on metacpan
Memory/Memory.xs view on Meta::CPAN
long
FreeMemSys()
#endif
=item ReserveMem BYTECOUNT
=item ReserveMemSys BYTECOUNT
B<Mac OS only.> (ReserveMemSys)
The ReserveMem procedure attempts to create free space for a block of $BYTECOUNT
contiguous logical bytes at the lowest possible position in the current heap
zone. It pursues every available means of placing the block as close as possible
to the bottom of the zone, including moving other relocatable blocks upward,
expanding the zone (if possible), and purging blocks from it.
ReserveMemSys does the same for the system heap.
=cut
void
ReserveMem(cbNeeded)
long cbNeeded
#ifndef MACOS_TRADITIONAL
void
ReserveMemSys(cbNeeded)
long cbNeeded
CODE:
croak("Usage: Mac::Memory::ReserveMemSys unsupported in Carbon");
#else
void
ReserveMemSys(cbNeeded)
long cbNeeded
#endif
=item MaxMem
=item MaxMemSys
B<Mac OS only.> (MaxMemSys)
Use the MaxMem function to compact and purge the current heap zone. The values
returned are the amount of memory available and the amount by which the zone can
grow.
($SIZE, $GROW) = &MaxMem;
MaxMemSys does the purge and compact of the system heap zone, and the $GROW value
is set to zero.
=cut
void
MaxMem()
PPCODE:
{
long grow;
XS_PUSH(long, MaxMem(&grow));
if (GIMME == G_ARRAY) {
XS_PUSH(long, grow);
}
}
void
MaxMemSys()
PPCODE:
{
#ifndef MACOS_TRADITIONAL
croak("Usage: Mac::Memory::MaxMemSys unsupported in Carbon");
#else
long grow;
XS_PUSH(long, MaxMemSys(&grow));
if (GIMME == G_ARRAY) {
XS_PUSH(long, grow);
}
#endif
}
=item MoveHHi HANDLE
The MoveHHi procedure attempts to move the relocatable block referenced by the
handle $HANDLE upward until it reaches a nonrelocatable block, a locked relocatable
block, or the top of the heap.
=cut
void
MoveHHi(h)
Handle h
CLEANUP:
MemErrorReturn
=item DisposePtr PTR
Releases the memory occupied by the nonrelocatable block specified by $PTR.
=cut
void
DisposePtr(p)
Ptr p
CLEANUP:
MemErrorReturn
=item GetPtrSize PTR
The GetPtrSize function returns the logical size, in bytes, of the nonrelocatable
block pointed to by $PTR.
=cut
long
GetPtrSize(p)
Ptr p
CLEANUP:
gMacPerl_OSErr = MemError();
=item SetPtrSize PTR, NEWSIZE
The SetPtrSize procedure attempts to change the logical size of the
nonrelocatable block pointed to by $PTR. The new logical size is specified by
$NEWSIZE.
Return zero if no error was detected.
Memory/Memory.xs view on Meta::CPAN
=item EmptyHandle
Free memory taken by a relocatable block without freeing the relocatable block's
master pointer for other uses.
=cut
void
EmptyHandle(h)
Handle h
CLEANUP:
MemErrorReturn
=item MoreMasters
Call the MoreMasters procedure several times at the beginning of your program to
prevent the Memory Manager from running out of master pointers in the middle of
application execution. If it does run out, it allocates more, possibly causing
heap fragmentation.
=cut
void
MoreMasters()
CLEANUP:
MemErrorReturn
=item BlockMove SOURCEPTR, DESTPTR, BYTECOUNT
=item BlockMoveData SOURCEPTR, DESTPTR, BYTECOUNT
The BlockMove/BlockMoveData procedure moves a block of $BYTECOUNT consecutive bytes from the
address designated by $SOURCEPTR to that designated by $DESTPTR.
=cut
void
BlockMove(srcPtr, destPtr, byteCount)
RawPtr srcPtr
RawPtr destPtr
long byteCount
void
BlockMoveData(srcPtr, destPtr, byteCount)
RawPtr srcPtr
RawPtr destPtr
long byteCount
=item PurgeSpace
Determine the total amount of free memory and the size of the largest allocatable
block after a purge of the heap.
($Total, $Contiguous) = &PurgeSpace;
=cut
void
PurgeSpace()
PPCODE:
{
long total;
long contig;
PurgeSpace(&total, &contig);
EXTEND(sp, 2);
PUSHs(sv_2mortal(newSViv(total)));
PUSHs(sv_2mortal(newSViv(contig)));
}
=item HGetState HANDLE
Get the current properties of a relocatable block (perhaps so that you can change
and then later restore those properties).
=cut
char
HGetState(h)
Handle h
CLEANUP:
if (gMacPerl_OSErr = MemError())
RETVAL = 0;
=item HSetState HANDLE, STATE
Restore properties of a block after a call to HGetState.
=cut
void
HSetState(h, flags)
Handle h
char flags
CLEANUP:
MemErrorReturn
=item HandToHand HANDLE
The HandToHand function attempts to copy the information in the relocatable block
to which $HANDLE is a handle.
Return C<undef> if an error was detected.
=cut
Handle
HandToHand(theHndl)
Handle &theHndl
CODE:
if (gMacPerl_OSErr = HandToHand(&theHndl)) {
XSRETURN_UNDEF;
} else {
RETVAL = theHndl;
}
OUTPUT:
RETVAL
=item PtrToHand PTR, BYTECOUNT
The PtrToHand function returns a newly created handle to a copy of
( run in 0.673 second using v1.01-cache-2.11-cpan-5511b514fd6 )