summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7b45526)
raw | patch | inline | side by side (parent: 7b45526)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 17 Jun 2019 15:08:51 +0000 (18:08 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 17 Jun 2019 15:08:51 +0000 (18:08 +0300) |
diff --git a/src/cpfront/posix/generic/System/Mod/Kernel.cp b/src/cpfront/posix/generic/System/Mod/Kernel.cp
index 82cac15b66e2ef650ba300c6444e9f28ce25bf19..8d4c334f2896df1262b8371a0fef66ecfbfcb3c2 100644 (file)
PROCEDURE AllocHeapMem (size: INTEGER; VAR c: Cluster);
CONST N = 65536; (* cluster size for dll *)
- VAR adr, allocated: INTEGER;
+ VAR adr, allocated, newsize: INTEGER;
BEGIN
INC(size, 16);
ASSERT(size > 0, 100); adr := 0;
- IF size < N THEN adr := stdlib.malloc(N) END;
- IF adr = 0 THEN adr := stdlib.malloc(size); allocated := size ELSE allocated := N END;
+ IF size < N THEN
+ adr := AllocMem(N, newsize);
+ allocated := newsize
+ END;
+ IF adr = 0 THEN
+ adr := AllocMem(size, newsize);
+ allocated := newsize
+ END;
IF adr = 0 THEN c := NIL
ELSE
c := S.VAL(Cluster, (adr + 15) DIV 16 * 16); c.max := adr;
PROCEDURE FreeHeapMem (c: Cluster);
BEGIN
DEC(used, c.size); DEC(total, c.size);
- stdlib.free(S.VAL(ADDRESS, c.max))
+ FreeMem(S.VAL(ADDRESS, c.max), c.size)
END FreeHeapMem;
PROCEDURE HeapFull (size: INTEGER): BOOLEAN;
diff --git a/src/native/linux/generic/System/Mod/Kernel.cp b/src/native/linux/generic/System/Mod/Kernel.cp
index 3e0ee50ad30e36e40d85dc4849aff659aa35c0f3..115a773f82860be78230ca4b089622ee056e17aa 100644 (file)
PROCEDURE AllocHeapMem (size: INTEGER; VAR c: Cluster);
CONST N = 65536; (* cluster size for dll *)
- VAR adr, allocated: INTEGER;
+ VAR adr, allocated, newsize: INTEGER;
BEGIN
INC(size, 16);
ASSERT(size > 0, 100); adr := 0;
- IF size < N THEN adr := stdlib.malloc(N) END;
- IF adr = 0 THEN adr := stdlib.malloc(size); allocated := size ELSE allocated := N END;
+ IF size < N THEN
+ adr := AllocMem(N, newsize);
+ allocated := newsize
+ END;
+ IF adr = 0 THEN
+ adr := AllocMem(size, newsize);
+ allocated := newsize
+ END;
IF adr = 0 THEN c := NIL
ELSE
c := S.VAL(Cluster, (adr + 15) DIV 16 * 16); c.max := adr;
PROCEDURE FreeHeapMem (c: Cluster);
BEGIN
DEC(used, c.size); DEC(total, c.size);
- stdlib.free(S.VAL(ADDRESS, c.max))
+ FreeMem(S.VAL(ADDRESS, c.max), c.size)
END FreeHeapMem;
PROCEDURE HeapFull (size: INTEGER): BOOLEAN;
diff --git a/src/native/posix/generic/System/Mod/Kernel.cp b/src/native/posix/generic/System/Mod/Kernel.cp
index 083c9977a5c89f92fbc11ed1444189e2ee5828f4..986425d7ce5ae66305c5713c3735afd21afedf72 100644 (file)
PROCEDURE AllocHeapMem (size: INTEGER; VAR c: Cluster);
CONST N = 65536; (* cluster size for dll *)
- VAR adr, allocated: INTEGER;
+ VAR adr, allocated, newsize: INTEGER;
BEGIN
INC(size, 16);
ASSERT(size > 0, 100); adr := 0;
- IF size < N THEN adr := stdlib.malloc(N) END;
- IF adr = 0 THEN adr := stdlib.malloc(size); allocated := size ELSE allocated := N END;
+ IF size < N THEN
+ adr := AllocMem(N, newsize);
+ allocated := newsize
+ END;
+ IF adr = 0 THEN
+ adr := AllocMem(size, newsize);
+ allocated := newsize
+ END;
IF adr = 0 THEN c := NIL
ELSE
c := S.VAL(Cluster, (adr + 15) DIV 16 * 16); c.max := adr;
PROCEDURE FreeHeapMem (c: Cluster);
BEGIN
DEC(used, c.size); DEC(total, c.size);
- stdlib.free(S.VAL(ADDRESS, c.max))
+ FreeMem(S.VAL(ADDRESS, c.max), c.size)
END FreeHeapMem;
PROCEDURE HeapFull (size: INTEGER): BOOLEAN;