Discussion:
memcpy malloc
(too old to reply)
EECS Instructional Account
2008-08-11 05:29:03 UTC
Permalink
for proj4, whe we use memcpy, I had to malloc space for the byte array to
come from or to the main memory, so that means we must free these malloc
pointers right, is it okay to do it return before returning from
accessMemory function, the only reason I hesitate is since this cache
needs to keep its values and its state across accessMemory calss, I dont
want free to mess it up

basically, are we even supposed to use malloc and free in accordnace iwth
memcpy or anywhere in this proj4?
Stephen Tu
2008-08-11 05:42:47 UTC
Permalink
Post by EECS Instructional Account
for proj4, whe we use memcpy, I had to malloc space for the byte array
to come from or to the main memory, so that means we must free these
malloc pointers right, is it okay to do it return before returning from
accessMemory function, the only reason I hesitate is since this cache
needs to keep its values and its state across accessMemory calss, I dont
want free to mess it up
basically, are we even supposed to use malloc and free in accordnace
iwth memcpy or anywhere in this proj4?
whoa, where are you mallocing??

the cache block structs come pre-malloced for us, so we can just pass
the pointer to its data, and the data pointer that is passed into the
accessMemory function is also a valid pointer.

Loading...