Catching memory allocation exceptions

Tech-Archive recommends: Fix windows errors by optimizing your registry



I haven't used C++ exception handling a lot in the past and I am about to
begin using it for an app I am working on.

I have to allocate large arrays of data for a 3 channel waveform made up of
about 40 megasamples of 16 bit (short) data each.

I am not really sure how much of that I can stream off disk at once. I would
like to learn how much memory 'would' be available to me and then create the
arrays with the amount of available memory.

Q1 ---> I am using the 'new' / 'delete[]' method but I don;t understand how
I might predetermine how much memory I can have. Would I loop with
tryu/new/catch until I have a successful allocation?

Once I figure out the proper combination of try/catch/throw to use (any
examples welcome) ..

Q2 ---> How do I actually 'cause' an exception like that to test it?


thanks

eng


.



Relevant Pages

  • memory leak in (?)... (redux)
    ... the mem leaks in our long-running tcl daemons. ... when actively exercised the app grows continuously. ... the mystery is that while our audit code does show us a couple of arrays ... and memory are checked and meanwhile externally, ...
    (comp.lang.tcl)
  • Re: Problem closing app with big UDT
    ... Longs, Doubles and byte arrays. ... it runs fine until I shut down the app. ... That's a new one for me -- never tried to create a UDT that large. ... you just corrupt memory. ...
    (microsoft.public.vb.general.discussion)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.setup)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.misc)
  • Re: need a thumbnail browser without memory limitations
    ... When you are working with media files, you need to decide how you are going to limit the memory requirements of your app. ... For display pictures, you can take approaches that limit the memory requirements such as minimal caching. ... lets say you need to load the next 10 thumbnails as the user scrolls. ...
    (microsoft.public.vb.general.discussion)