Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
FPC development
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED]cmem.CFreeMemSize possible error
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
lazarus 4.99 and missing ...
by
ginoo
[
Today
at 08:28:52 am]
could Ardour's YTK be use...
by
AmatCoder
[
Today
at 08:09:55 am]
GTK3 : Icons have borders...
by
AmatCoder
[
Today
at 07:49:59 am]
CONCAT formula
by
veb86
[
Today
at 07:26:49 am]
Questions about TFuncSeri...
by
hedgehog
[
Today
at 06:58:29 am]
Getting results from sql ...
by
paweld
[
Today
at 06:05:00 am]
Problem with drawing orde...
by
wp
[
Today
at 12:57:00 am]
Initialization & finaliza...
by
Martin_fr
[March 14, 2026, 10:22:21 pm]
Hello! Anything new?
by
440bx
[March 14, 2026, 07:51:50 pm]
CryptoLib4Pascal
by
Xor-el
[March 14, 2026, 06:17:32 pm]
Extended Module Player
by
Gigatron
[March 14, 2026, 05:32:06 pm]
[AGGPas] Difference betwe...
by
Roland57
[March 14, 2026, 04:36:02 pm]
declaring Array
by
Thaddy
[March 14, 2026, 01:24:11 pm]
TChart: Wrong default val...
by
wp
[March 14, 2026, 11:30:54 am]
Text Fill (Memo)
by
paweld
[March 14, 2026, 09:09:13 am]
Qt6/Wayland clipboard: pa...
by
AlexTP
[March 14, 2026, 08:56:58 am]
Pocketbase
by
PierceNg
[March 14, 2026, 06:29:04 am]
ADUG Symposium 2026
by
Mathias Burbach
[March 14, 2026, 04:45:57 am]
Any way to "embed" Window...
by
jamie
[March 14, 2026, 12:55:37 am]
DataPort StopBits and Flo...
by
Thaddy
[March 13, 2026, 02:14:16 pm]
Lazarus Bugfix Release 4....
by
JuhaManninen
[March 13, 2026, 10:05:03 am]
88 year D. Knuth changes ...
by
Thaddy
[March 13, 2026, 07:31:38 am]
interface and GUID someth...
by
egsuh
[March 13, 2026, 03:31:00 am]
CADSys4 3D.
by
maurog
[March 13, 2026, 01:00:05 am]
UOS - pre-compiled librar...
by
Fred vS
[March 13, 2026, 12:34:06 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED]cmem.CFreeMemSize possible error (Read 1239 times)
BrunoK
Hero Member
Posts: 766
Retired programmer
[SOLVED]cmem.CFreeMemSize possible error
«
on:
January 13, 2022, 07:23:25 pm »
FPC 3.2.2 and 3.0.4
in \rtl\inc\cmem.pp
It seems to me that :
Code: Pascal
[Select]
[+]
[-]
Function
CFreeMemSize
(
p
:
pointer
;
Size
:
ptruint
)
:
ptruint
;
begin
if
size<
=
0
then
exit
;
if
(
p <>
nil
)
then
begin
if
(
size <> Pptruint
(
p
-
sizeof
(
ptruint
)
)
^
)
then
runerror
(
204
)
;
end
;
CFreeMemSize
:
=
CFreeMem
(
P
)
;
end
;
should be
Code: Pascal
[Select]
[+]
[-]
Function
CFreeMemSize
(
p
:
pointer
;
Size
:
ptruint
)
:
ptruint
;
begin
if
size<
=
0
then
exit
;
if
(
p <>
nil
)
then
begin
if
(
size <> Pptruint
(
p
-
sizeof
(
ptruint
)
)
^
)
then
runerror
(
204
)
;
dec
(
p
,
sizeof
(
ptruint
)
)
;
// <<<<------ here
end
;
CFreeMemSize
:
=
CFreeMem
(
P
)
;
end
;
The dec(p,sizeof(ptruint)); seems to be missing to get the pointer to pass to cmem CFreeMem library function.
What do you think ?
It seems to have no consequence because it is apparently never called by fpc or lazarus but it looks anyway like a possible bug.
«
Last Edit: January 13, 2022, 07:31:52 pm by BrunoK
»
Logged
Jonas Maebe
Hero Member
Posts: 1071
Re: cmem.CFreeMemSize possible error
«
Reply #1 on:
January 13, 2022, 07:25:25 pm »
CFreeMem does that dec already (it's a Pascal routine defined in the same unit, not the C library "free").
Logged
BrunoK
Hero Member
Posts: 766
Retired programmer
Re: cmem.CFreeMemSize possible error
«
Reply #2 on:
January 13, 2022, 07:30:30 pm »
Yes sir ! Sorry, my bad.
I didn't notice that it was calling an 'internal' CFreeMem procedure.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
FPC development
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED]cmem.CFreeMemSize possible error
TinyPortal
© 2005-2018