impossible to allocate memory 
Author Message
 impossible to allocate memory

Hello,

The following line of code generates a problem :
"segment1.push_back( -100.00 );"
The size of the vector is 32 at this moment.
This line of code has already been executed without problems.

It's a Win32 Console Application with no memory leaks ( tested with
Rational Rose 2002). When the application crashes, it takes 381 Mb of
memory.
My PC is :
Athlon XP 1800
1500 Mb of RAM
Windows 2000
VC++6 SP Enterprise Edition & Service Pack 5

If I try with less data, it works. Is there a limit of use of memory
with this kind of application ?

Thanks,

Jeannot Lelapin

**************************************************************************
The text of the de{*filter*} dialogbox
**************************************************************************
User breakpoint called from code at 0x7848018c

***************************************************************************
The call stack
***************************************************************************
NTDLL! 7848018c()
NTDLL! 7848739b()
NTDLL! 78494e73()
NTDLL! 78487004()
NTDLL! 784aba91()
_heap_alloc_base(unsigned int 304) line 200
_heap_alloc_dbg(unsigned int 256, int 1, const char * 0x00000000, int 0)
line 378 + 9 bytes
_nh_malloc_dbg(unsigned int 256, int 0, int 1, const char * 0x00000000,
int 0) line 248 + 21 bytes
_malloc_dbg(unsigned int 256, int 1, const char * 0x00000000, int 0)
line 165 + 27 bytes
operator new(unsigned int 256) line 325 + 16 bytes
std::_Allocate(int 64, float * 0x00000000) line 30 + 12 bytes
std::allocator<float>::allocate(unsigned int 64, const void *
0x00000000) line 59 + 40 bytes
std::vector<float,std::allocator<float> >::insert(float * 0x2237a178,
unsigned int 1, const float & -100.000) line 158 + 14 bytes
std::vector<float,std::allocator<float> >::insert(float * 0x2237a178,
const float & -100.000) line 154
std::vector<float,std::allocator<float> >::push_back(const float &
-100.000) line 142 + 50 bytes
CART::CART::VarianceMin(float & 3012.14, float & -62.3375, unsigned char
& 0, const std::vector<CART::SrcTgt,std::allocator<CART::SrcTgt> > &
{...}) line 607

***************************************************************************
The information on the screen
***************************************************************************
7848018C   int         3
7848018D   ret
7848018E   int         3
7848018F   ret
78480190   mov         eax,dword ptr [esp+4]
78480194   int         3
78480195   ret         4
78480198   mov         eax,dword ptr [ebp-14h]
7848019B   mov         eax,dword ptr [eax]
7848019D   mov         eax,dword ptr [eax]
7848019F   mov         dword ptr [ebp-280h],eax
784801A5   push        1
784801A7   pop         eax
784801A8   ret
784801A9   mov         esp,dword ptr [ebp-18h]
784801AC   mov         esi,dword ptr [ebp-280h]
784801B2   or          dword ptr [ebp-4],0FFFFFFFFh
784801B6   xor         ebx,ebx
784801B8   jmp         78473EB6
784801BD   mov         eax,fs:[00000018]
784801C3   mov         byte ptr [eax+0F74h],bl
784801C9   mov         eax,esi
784801CB   jmp         78473F1A
784801D0   mov         eax,200h
784801D5   mov         byte ptr [ebp-19h],0Ah
784801D9   jmp         78473ECD
784801DE   mov         dword ptr [ebp-27Ch],40010006h
784801E8   mov         dword ptr [ebp-274h],ebx
784801EE   mov         dword ptr [ebp-26Ch],2
784801F8   mov         dword ptr [ebp-278h],ebx
784801FE   movzx       eax,word ptr [ebp-228h]
78480205   inc         eax
78480206   mov         dword ptr [ebp-268h],eax
7848020C   mov         eax,dword ptr [ebp-224h]
78480212   mov         dword ptr [ebp-264h],eax
78480218   lea         eax,[ebp-27Ch]
7848021E   push        eax
7848021F   call        78490F18
78480224   mov         eax,fs:[00000018]
7848022A   mov         byte ptr [eax+0F74h],bl
78480230   xor         eax,eax
78480232   jmp         78473F1A
78480237   push        1
78480239   call        78480190
................



Mon, 27 Dec 2004 00:39:32 GMT  
 impossible to allocate memory
Such problems very often result from a corrupted heap. Some completely
unrelated part of your program allocates a memory buffer from the heap
and writes beyond the boundaries of said buffer. This corrupts internal
data structures used by heap manager to keep track of heap allocations.
Later, some other part of your program needs to allocate memory, and
this causes heap manager to consult corrupted data structures. This
causes a crash.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> Hello,

> The following line of code generates a problem :
> "segment1.push_back( -100.00 );"
> The size of the vector is 32 at this moment.
> This line of code has already been executed without problems.

> It's a Win32 Console Application with no memory leaks ( tested with
> Rational Rose 2002). When the application crashes, it takes 381 Mb of
> memory.
> My PC is :
> Athlon XP 1800
> 1500 Mb of RAM
> Windows 2000
> VC++6 SP Enterprise Edition & Service Pack 5

> If I try with less data, it works. Is there a limit of use of memory
> with this kind of application ?

> Thanks,

> Jeannot Lelapin

************************************************************************
**
Quote:
> The text of the de{*filter*} dialogbox

************************************************************************
**
Quote:
> User breakpoint called from code at 0x7848018c

************************************************************************
***
Quote:
> The call stack

************************************************************************
***

- Show quoted text -

Quote:
> NTDLL! 7848018c()
> NTDLL! 7848739b()
> NTDLL! 78494e73()
> NTDLL! 78487004()
> NTDLL! 784aba91()
> _heap_alloc_base(unsigned int 304) line 200
> _heap_alloc_dbg(unsigned int 256, int 1, const char * 0x00000000, int
0)
> line 378 + 9 bytes
> _nh_malloc_dbg(unsigned int 256, int 0, int 1, const char *
0x00000000,
> int 0) line 248 + 21 bytes
> _malloc_dbg(unsigned int 256, int 1, const char * 0x00000000, int 0)
> line 165 + 27 bytes
> operator new(unsigned int 256) line 325 + 16 bytes
> std::_Allocate(int 64, float * 0x00000000) line 30 + 12 bytes
> std::allocator<float>::allocate(unsigned int 64, const void *
> 0x00000000) line 59 + 40 bytes
> std::vector<float,std::allocator<float> >::insert(float * 0x2237a178,
> unsigned int 1, const float & -100.000) line 158 + 14 bytes
> std::vector<float,std::allocator<float> >::insert(float * 0x2237a178,
> const float & -100.000) line 154
> std::vector<float,std::allocator<float> >::push_back(const float &
> -100.000) line 142 + 50 bytes
> CART::CART::VarianceMin(float & 3012.14, float & -62.3375, unsigned
char
> & 0, const std::vector<CART::SrcTgt,std::allocator<CART::SrcTgt> > &
> {...}) line 607

************************************************************************
***
Quote:
> The information on the screen

************************************************************************
***

- Show quoted text -

Quote:
> 7848018C   int         3
> 7848018D   ret
> 7848018E   int         3
> 7848018F   ret
> 78480190   mov         eax,dword ptr [esp+4]
> 78480194   int         3
> 78480195   ret         4
> 78480198   mov         eax,dword ptr [ebp-14h]
> 7848019B   mov         eax,dword ptr [eax]
> 7848019D   mov         eax,dword ptr [eax]
> 7848019F   mov         dword ptr [ebp-280h],eax
> 784801A5   push        1
> 784801A7   pop         eax
> 784801A8   ret
> 784801A9   mov         esp,dword ptr [ebp-18h]
> 784801AC   mov         esi,dword ptr [ebp-280h]
> 784801B2   or          dword ptr [ebp-4],0FFFFFFFFh
> 784801B6   xor         ebx,ebx
> 784801B8   jmp         78473EB6
> 784801BD   mov         eax,fs:[00000018]
> 784801C3   mov         byte ptr [eax+0F74h],bl
> 784801C9   mov         eax,esi
> 784801CB   jmp         78473F1A
> 784801D0   mov         eax,200h
> 784801D5   mov         byte ptr [ebp-19h],0Ah
> 784801D9   jmp         78473ECD
> 784801DE   mov         dword ptr [ebp-27Ch],40010006h
> 784801E8   mov         dword ptr [ebp-274h],ebx
> 784801EE   mov         dword ptr [ebp-26Ch],2
> 784801F8   mov         dword ptr [ebp-278h],ebx
> 784801FE   movzx       eax,word ptr [ebp-228h]
> 78480205   inc         eax
> 78480206   mov         dword ptr [ebp-268h],eax
> 7848020C   mov         eax,dword ptr [ebp-224h]
> 78480212   mov         dword ptr [ebp-264h],eax
> 78480218   lea         eax,[ebp-27Ch]
> 7848021E   push        eax
> 7848021F   call        78490F18
> 78480224   mov         eax,fs:[00000018]
> 7848022A   mov         byte ptr [eax+0F74h],bl
> 78480230   xor         eax,eax
> 78480232   jmp         78473F1A
> 78480237   push        1
> 78480239   call        78480190
> ................



Mon, 27 Dec 2004 00:51:07 GMT  
 impossible to allocate memory
FWIW, also see discussion on identical post to
microsoft.public.vc.language

Please cross-post in preference to multiposting.



Mon, 27 Dec 2004 02:44:26 GMT  
 impossible to allocate memory
Thanks Igor for the explanation. Is there a solution to find heap
corruption and avoit them ?
Contrary to my first post, I have the same problem with 120 Mb of data
in use after 7 hours of program running.

Jeannot Lelapin

Quote:

> Such problems very often result from a corrupted heap. Some completely
> unrelated part of your program allocates a memory buffer from the heap
> and writes beyond the boundaries of said buffer. This corrupts internal
> data structures used by heap manager to keep track of heap allocations.
> Later, some other part of your program needs to allocate memory, and
> this causes heap manager to consult corrupted data structures. This
> causes a crash.
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



Mon, 27 Dec 2004 15:39:58 GMT  
 impossible to allocate memory
Excuse me, What is the difference between cross-post and multiposting ?

Jeannot Lelapin,

Quote:

> FWIW, also see discussion on identical post to
> microsoft.public.vc.language

> Please cross-post in preference to multiposting.



Mon, 27 Dec 2004 15:41:48 GMT  
 impossible to allocate memory
Sorry, I wrote my mail too quickly. Even with less data, it crashes.
I have already write a program with such amount of data. I don't understand.
I modified the code. I use pointer parameter in place of reference
parameter, and the program crash after 7 hours in place of 1 hour 30.

Jeannot Lelapin



Mon, 27 Dec 2004 16:26:03 GMT  
 impossible to allocate memory

Quote:
> Excuse me, What is the difference between cross-post and multiposting ?

Cross-posts are done once and go to multiple groups. The important thing is
that when someone replies, everyone in all the cross-posted groups sees the
answer.

A multi-post has an answer that is only seen in the group to which it was
replied. Craig doesn't want to have to write the same answer more than once
(in the multiple groups you posted to).

HTH, Loz.



Mon, 27 Dec 2004 17:27:26 GMT  
 impossible to allocate memory
Ok Lawrence.

Jeannot Lelapin



Mon, 27 Dec 2004 21:04:47 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Impossible to allocate memory

2. Questions about memory size and memory allocate.

3. Allocating a memory block that doesn't overlap physical memory

4. Dynamic allocate memory size in memory mapping

5. allocate memory in a predifined location of the memory

6. Memory leak detection impossible with STL???

7. Released allocated memory

8. memory allocated to structures

9. What is the proper way to allocate and free memory in this instance

10. Possible to allocate 1 Megabyte of memory?

11. allocating memory for a char **

12. Allocating memory for a matrix

 

 
Powered by phpBB® Forum Software