Home » U++ Library support » U++ Core » How to respond when memory is exceeded
Re: How to respond when memory is exceeded [message #61100 is a reply to message #61099] |
Mon, 18 November 2024 10:09   |
 |
koldo
Messages: 3443 Registered: August 2008
|
Senior Veteran |
|
|
Hello Mirek
This is a very simple test code to force the problem:
GUI_APP_MAIN
{
WithMain<TopWindow> dlg;
CtrlLayout(dlg, "Memory test");
dlg.butTest.WhenAction = []{
try {
Buffer<int> data;
data.Alloc(123456789012, 0);
PromptOK("Memory is alloc");
} catch (const std::bad_alloc& e) {
Exclamation("Caught bad_alloc");
}
};
dlg.Execute();
}

And this is the change in U++:
void OutOfMemoryPanic(size_t size)
{
throw std::bad_alloc();
/*char h[200];
snprintf(h, 200, "Out of memory!\nU++ allocated memory: %d KB", MemoryUsedKb());
Panic(h);*/
}
When pushing the button 5 times, no problem happens. Visually monitoring the Windows Task Manager, MemoryTest.exe seems to use the same memory all the time.
However, pushing the button one more time, MemoryLimitKb breached! Panic appears. It happens the same in debug and in release.
Best regards
IƱaki
|
|
|
 |
|
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: Tue Aug 26 14:23:06 CEST 2025
Total time taken to generate the page: 0.07644 seconds
|