Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
Unix
(Moderators:
FPK
,
Tomas Hajny
) »
Allocate memory pages
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
I have made some progress...
by
onionmixer
[
Today
at 09:03:16 am]
FPC Unleashed (async/awai...
by
Thaddy
[
Today
at 08:31:58 am]
Windows Installer with FP...
by
Martin_fr
[
Today
at 07:42:28 am]
GTK3 is now the default w...
by
dbannon
[
Today
at 03:25:30 am]
Parsing error?
by
jlinux
[
Today
at 02:15:42 am]
Putting a new file on a w...
by
J-G
[July 18, 2026, 11:10:43 pm]
[SOLVED]Problem with Mari...
by
Tomu
[July 18, 2026, 10:49:15 pm]
debugger error
by
Martin_fr
[July 18, 2026, 10:38:42 pm]
TCHATGPT — An Artificial ...
by
schuler
[July 18, 2026, 10:00:48 pm]
Which quantized model wor...
by
schuler
[July 18, 2026, 09:45:50 pm]
Slow app start on M5 MacB...
by
Thaddy
[July 18, 2026, 08:16:52 pm]
Peculiarities in the EXE ...
by
Thaddy
[July 18, 2026, 07:49:45 pm]
Windows 2026_7 update and...
by
Martin_fr
[July 18, 2026, 06:23:32 pm]
KOL4 Beta available.
by
Thaddy
[July 18, 2026, 06:23:08 pm]
This week in OPM!
by
wp
[July 18, 2026, 01:59:33 pm]
FastCGI vs. CGI
by
Thaddy
[July 18, 2026, 01:32:45 pm]
Testing Antropic
by
Tomxe
[July 18, 2026, 12:46:14 pm]
authentiacte through goog...
by
Thaddy
[July 18, 2026, 09:12:56 am]
[SOLVED] Stopped compilin...
by
CM630
[July 18, 2026, 08:41:58 am]
[CLOSED] Seeking performa...
by
Xenno
[July 18, 2026, 08:11:26 am]
Lazarus Main not building...
by
Thaddy
[July 18, 2026, 06:31:42 am]
Setting the CURSOR for th...
by
jamie
[July 18, 2026, 02:16:55 am]
TPeriodicTable
by
wp
[July 18, 2026, 12:19:25 am]
How to connect to MariaDb...
by
jcmontherock
[July 17, 2026, 06:23:38 pm]
Accessing VRAM memory wit...
by
LemonParty
[July 17, 2026, 04:45:30 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Allocate memory pages (Read 3040 times)
LemonParty
Hero Member
Posts: 560
Allocate memory pages
«
on:
February 27, 2025, 03:46:39 pm »
In Windows we have VirtualAlloc function for allocate memory pages. What is used in UNIX?
Logged
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11
Khrys
Sr. Member
Posts: 470
Re: Allocate memory pages
«
Reply #1 on:
February 27, 2025, 03:50:55 pm »
mmap
, and
mprotect
is analogous to
VirtualProtect
Logged
LemonParty
Hero Member
Posts: 560
Re: Allocate memory pages
«
Reply #2 on:
February 27, 2025, 04:14:43 pm »
So if I want just memory I have to pass 0 to fd and offset arguments of mmap?
Logged
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11
MarkMLl
Hero Member
Posts: 8575
Re: Allocate memory pages
«
Reply #3 on:
February 27, 2025, 05:04:19 pm »
Quote from: LemonParty on February 27, 2025, 04:14:43 pm
So if I want just memory I have to pass 0 to fd and offset arguments of mmap?
There's an example at
https://www.freepascal.org/docs-html/current/rtl/baseunix/fpmmap.html
which suggests that it's not that simple. I've not used it ** , and suggest that you look for online examples- even if (shock! Horror!!) they're written in C etc.
** I've not used it
in Pascal
. I've used it in some C-based video stuff, but was doing so by rote based on existing code and there is absolutely no way I'd set myself up as an expert. I believe it's covered by POSIX, so examples should be fairly portable.
MarkMLl
Logged
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories:
https://github.com/MarkMLl?tab=repositories
LemonParty
Hero Member
Posts: 560
Re: Allocate memory pages
«
Reply #4 on:
February 27, 2025, 05:52:38 pm »
Seems work.
Code: Pascal
[Select]
[+]
[-]
Fpmmap
(
nil
,
Size
,
PROT_EXEC
or
PROT_READ
or
PROT_WRITE
,
MAP_SHARED
or
MAP_ANONYMOUS
,
-
1
,
0
)
MAP_ANONYMOUS should be specified if no need to map to a file.
Logged
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
Unix
(Moderators:
FPK
,
Tomas Hajny
) »
Allocate memory pages
TinyPortal
© 2005-2018