Forum Post: RE: Handling System Error: Memory Violation

  • Thread starter Thread starter gus
  • Start date Start date
Status
Not open for further replies.
G

gus

Guest
another commonly used approach is to pass the buffer size to the called function and then before copying data back, it checks the size. the read() system call for example, takes a file descriptor, buffer address and buffer size. it reads at most the number of bytes that will fit and returns the actual number of bytes transferred. as for the handling memory violation, when that occurs, it is nearly always too late. the damage has been done and some data has been smashed. continuing from the point of interruption will most likely cause the memory violation to recur. so the 4gl runtime cannot suppress or ignore memory violations. your only choice is to check the buffer size before it is too late.

Continue reading...
 
Status
Not open for further replies.
Back
Top