Home » U++ Library support » U++ Core » [FIXED] String::Replace(empty string,) => Out of memory!
[FIXED] String::Replace(empty string,) => Out of memory! [message #43074] |
Fri, 02 May 2014 16:16  |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
Hi,
a call to crash if f.GetCount is equal to 0, with message:
Out of memory!
Request size : 905969755 B
U++ allocated memory: 442520 KB
I found that is because Replace use t_find (StringFind.hpp line 30):
template <int step> // Template parameter to be a constant
int t_find(const char *ptr, int slen, const char *p, int len, int from)
and t_find returns 0 if slen is equal to 0.
else
if(len == 1) {
char p0 = p[0];
while(s <= e) {
if(*s == p0)
return (int)(s - ptr);
s += step;
}
}
else
return 0; <---- (line 87)
if t_find return -1 instead of 0, it resolve the issu.
Regards
omari.
regards
omari.
[Updated on: Sat, 18 March 2017 16:05] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Sun May 11 14:53:16 CEST 2025
Total time taken to generate the page: 0.00337 seconds
|