Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:docs:fapi:dosallocseg [2021/09/16 13:28] – prokushev | en:docs:fapi:dosallocseg [2021/09/17 09:18] (current) – prokushev | ||
---|---|---|---|
Line 36: | Line 36: | ||
A segment allocated by DosAllocSeg with AllocFlags bit 2 set can be discarded by the system to remedy a low memory situation when the segment is not in use. Upon allocation, a discardable segment is locked and ready for access. The caller issues [[DosUnlockSeg]] when it is finished using the segment. The next time the caller needs to access the segment, it must issue [[DosLockSeg]]. During the time a segment is locked, it cannot be discarded, but it can still be swapped. | A segment allocated by DosAllocSeg with AllocFlags bit 2 set can be discarded by the system to remedy a low memory situation when the segment is not in use. Upon allocation, a discardable segment is locked and ready for access. The caller issues [[DosUnlockSeg]] when it is finished using the segment. The next time the caller needs to access the segment, it must issue [[DosLockSeg]]. During the time a segment is locked, it cannot be discarded, but it can still be swapped. | ||
- | Allocate memory as discardable when it is needed to hold data for only short periods of time; for example, saved bit map images for obscured windows. Once the system discards a segment, the caller must reallocate the segment with DosReallocSeg and regenerate the data. Reallocating the segment automatically locks it for the first access. | + | Allocate memory as discardable when it is needed to hold data for only short periods of time; for example, saved bit map images for obscured windows. Once the system discards a segment, the caller must reallocate the segment with [[DosReallocSeg]] and regenerate the data. Reallocating the segment automatically locks it for the first access. |
- | A segment may also be designated as shared with another process. If a process issues DosAllocSeg with AllocFlags bit 0 set, then the segment allocated is shareable through DosGiveSeg. To share the segment in this manner, the owning process can then issue DosGiveSeg to obtain a selector for the sharer to use. The owning process then passes the selector to the sharer using some means of interprocess communication. The sharing process can use the selector to access the shared segment. If the shared segment has been designated discardable (AllocFlags bit 2 is also set), the sharer must issue DosLockSeg to lock the segment. | + | A segment may also be designated as shared with another process. If a process issues DosAllocSeg with AllocFlags bit 0 set, then the segment allocated is shareable through |
Memory allocated with DosAllocSeg is freed by a call to [[DosFreeSeg]]. | Memory allocated with DosAllocSeg is freed by a call to [[DosFreeSeg]]. | ||
Line 44: | Line 44: | ||
''' | ''' | ||
- | ===== Family API Considerations | + | ==== Family API Considerations ==== |
Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to DosAllocSeg when coding for the DOS mode: | Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to DosAllocSeg when coding for the DOS mode: | ||
Line 166: | Line 166: | ||
- | ====== Note ====== | + | ===== Note ===== |
Text based on [[http:// | Text based on [[http:// |