Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who is Online
59 user(s) are online (5 user(s) are browsing Forum)

Members: 0
Guests: 59

more...


Browsing this Thread:   1 Anonymous Users




(1) 2 »


Re: realloc()?
#11
Quite a regular
Quite a regular


See User information
I came across a nice description of C's memory allocator approach in an appendix of the K&R book and now I feel silly. Thanks for the help with this. My mental model model of malloc was rather simplistic.

Posted on: 2018/5/2 14:42
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#10
Quite a regular
Quite a regular


See User information
I missed your link earlier. Thanks for that.


Posted on: 2018/4/14 18:55
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#9
Home away from home
Home away from home


See User information
Quote:

mazze wrote:
Quote:

remotenemesis wrote:
So that'd be safe to use with memory allocated with AllocMem?


No. Don't mix C and Exec memory functions.

To elaborate: c uses it's own memory manager, and mixing those with api calls would interfere with its 'management'.

In that respect my link was meant to show you that it is trivial to implement

Posted on: 2018/4/14 17:47
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#8
Quite a regular
Quite a regular


See User information
Nice! Will do that thanks.

Posted on: 2018/4/14 16:03
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#7
Home away from home
Home away from home


See User information
Quote:

remotenemesis wrote:
OK, it was trivial to implement using AllocMem, FreeMem and memcpy. Thank you!


It would be more consistent to use CopyMem().

Posted on: 2018/4/14 15:57
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#6
Quite a regular
Quite a regular


See User information
OK, it was trivial to implement using AllocMem, FreeMem and memcpy. Thank you!

Posted on: 2018/4/14 6:04
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#5
Home away from home
Home away from home


See User information
Quote:

remotenemesis wrote:
So that'd be safe to use with memory allocated with AllocMem?


No. Don't mix C and Exec memory functions.

Posted on: 2018/4/13 6:03
AROS - Make code, not war :knuddel:
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#4
Quite a regular
Quite a regular


See User information
So that'd be safe to use with memory allocated with AllocMem? Would make sense if it did I guess.

Posted on: 2018/4/13 4:32
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#3
Home away from home
Home away from home


See User information
Unless using a compiler (program language specific) that offers such functionality.

for example AROS' stdc implements realloc().

Posted on: 2018/4/12 22:45
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: realloc()?
#2
Home away from home
Home away from home


See User information
No, I don't think there's a function like that.

Posted on: 2018/4/12 18:50
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 




(1) 2 »



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
4462
2 nikolaos
nikolaos
4206
3 magorium
magorium
4095
4 phoenixkonsole
phoenixkonsole
3942
5 deadwood
deadwood
2917
6 ncafferkey
ncafferkey
2810
7 mazze
mazze
2222
8 Kalamatee
Kalamatee
2212
9 clusteruk
clusteruk
2114
Powered by XOOPS © 2001-2025 The XOOPS Project