title: Artificially Limit C/C++ Memory Usage
body: <p>Is there any way to easily limit a C/C++ application to a specified amount of memory (30 mb or so)? Eg: if my application tries to complete load a 50mb file into memory it will die/print a message and quit/etc. </p>
  
  <p>Admittedly I can just constantly check the memory usage for the application, but it would be a bit easier if it would just die with an error if I went above. </p>
  
  <p>Any ideas? </p>
  
  <p>Platform isn't a big issue, windows/linux/whatever compiler. </p>