Home » U++ Library support » U++ Core » How to respond when memory is exceeded
Re: How to respond when memory is exceeded [message #61119 is a reply to message #61112] |
Tue, 19 November 2024 12:14  |
 |
mirek
Messages: 14265 Registered: November 2005
|
Ultimate Member |
|
|
So it is now implemented in "bad_alloc" branch. Basically, memory panic now throws bad_alloc which then caught in APP_MAIN to do normal Panic, so you can try and catch it.
Note that U++ code reaction to bad_alloc right now is
a) uncertain
b) likely and the ideal I will be striving upon, it is only safe to completely destruct U++ structures created in bad_alloc try block, there is no guarantee that any other operation works. Example:
VectorMap<String, String> map;
try {
map.Add("Hi", "there");
}
catch(std::bad_alloc) {}
is bad code. Instead you can use
VectorMap<String, String> map;
try {
VectorMap<String, String> map2;
map2.Add("Hi", "there");
map = pick(map);
}
catch(std::bad_alloc) {}
[Updated on: Tue, 19 November 2024 12:22] Report message to a moderator
|
|
|
 |
|
How to respond when memory is exceeded
By: koldo on Wed, 16 October 2024 09:41
|
 |
|
Re: How to respond when memory is exceeded
By: Lance on Wed, 16 October 2024 15:27
|
 |
|
Re: How to respond when memory is exceeded
By: koldo on Wed, 16 October 2024 16:18
|
 |
|
Re: How to respond when memory is exceeded
By: Lance on Wed, 16 October 2024 17:22
|
 |
|
Re: How to respond when memory is exceeded
By: mirek on Sun, 17 November 2024 16:07
|
 |
|
Re: How to respond when memory is exceeded
By: Lance on Mon, 18 November 2024 05:24
|
 |
|
Re: How to respond when memory is exceeded
By: mirek on Mon, 18 November 2024 08:01
|
 |
|
Re: How to respond when memory is exceeded
By: koldo on Mon, 18 November 2024 08:17
|
 |
|
Re: How to respond when memory is exceeded
By: mirek on Mon, 18 November 2024 08:39
|
 |
|
Re: How to respond when memory is exceeded
By: koldo on Mon, 18 November 2024 10:09
|
 |
|
Re: How to respond when memory is exceeded
By: mirek on Mon, 18 November 2024 12:31
|
 |
|
Re: How to respond when memory is exceeded
By: Lance on Mon, 18 November 2024 16:15
|
 |
|
Re: How to respond when memory is exceeded
By: koldo on Mon, 18 November 2024 19:36
|
 |
|
Re: How to respond when memory is exceeded
By: mirek on Mon, 18 November 2024 19:48
|
 |
|
Re: How to respond when memory is exceeded
By: koldo on Mon, 18 November 2024 20:01
|
 |
|
Re: How to respond when memory is exceeded
By: mirek on Tue, 19 November 2024 12:14
|
Goto Forum:
Current Time: Mon Jul 07 09:35:32 CEST 2025
Total time taken to generate the page: 0.03927 seconds
|