From: Joseph M. Newcomer on
Had you shown the actual code, instead of a vague handwave, we might have spotted it for
you. You did not justify the use of VirtualAlloc, so it was not clear why you needed some
complex method that was no more powerful than malloc or new, given the stated
requirements.

Had you stated why you were using VirtualAlloc and shown the code, the whole thing would
have been simpler to answer.
joe

On Sun, 9 Mar 2008 04:21:05 +0100, "Kerem G�mr�kc�" <kareem114(a)hotmail.com> wrote:

>Hi Joseph,
>
>>I keep being amazed by people who fail to define the entire
>>problem, and want a solution to some part of it.
>
>I dont understand,...if i could define the entire problem, be sure
>that i had solved it by my own. Thats why i asked this here, because
>it was not clear to me, why my mem usage decreased, even when i
>deallocated it. As told before, i have several wrappers around the
>VirtualAlloc/HeapAlloc and it was a implementation mistake i made.
>I passed a wrong parameter to the VirtualFree, but i was not aware
>of it, because it was no longer the original call to VirtualAlloc, it was
>wrapped by my function call,...
>
>>OK, you've justifed VirtualAlloc. You could have done this at the start.
>
>Was this necessary,...the original question was: Why does my application
>consume even more memory and why does it seem that it uses more
>and more memory, even for the case i free it and ensure clean
>allocation/freeing, even by securing things with SEH and Syncronization.
>Ok, i didnt tell SEH and Sync, but it was not necessary. Alexander pointed
>at the VirtualFree and yes, it was the right place to look. The wrappers
>look like "LPVOID vi_virtual_alloc(SIZE_T)" and vi_virtual_free(LPVOID).
>The Internals of the wrappers include some extra operation on the memory
>before it will be freed or returned to the caller. I passed a wrong
>parameter
>to VF, and thats because i overloaded a function and accidentally used its
>old parameter from the base function....
>
>Everything is now fine....
>
>Thanks!
>
>Regards
>
>K.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Kerem G�mr�kc� on
H Nathan,

>As I pointed out above, malloc is a perfectly reasonable function
>to use. It's 100% C, no C++. Go read your K&R if you don't believe
>me. Plus, malloc is portable to other systems just fine. As long
>as you balance your malloc/free calls, then your app should behave
>fine.

its not an option for me and my application is not portable to other
systems. Its ok to use it, but not in my case,...

Anyway thanks,...

Regards

K.

--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Nathan Mates" <nathan(a)visi.com> schrieb im Newsbeitrag
news:13t6q4pocv5k8d1(a)corp.supernews.com...
> In article <#ybgPCZgIHA.4712(a)TK2MSFTNGP04.phx.gbl>,
> Kerem G�mr�kc� <kareem114(a)hotmail.com> wrote:
>>>new and malloc both use the same heap, provided by the C Runtime
>>>library, which is used by C and/or C++ code. They can coexist just
>>>fine, no matter which language requested the memory, and nothing will
>>>be 'mixed up.' Plus, your code will be far more portable to other
>>>(i.e. non-Win32) systems.
>
>>Thank you i know that, but i hold my code strictly in C
>>and dont want to mix it with c++ language features. Yes,
>>in general there is no difference using them, but this time
>>its a language thing,...
>
> As I pointed out above, malloc is a perfectly reasonable function
> to use. It's 100% C, no C++. Go read your K&R if you don't believe
> me. Plus, malloc is portable to other systems just fine. As long
> as you balance your malloc/free calls, then your app should behave
> fine.
>
> Nathan Mates
> --
> <*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
> # Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
> # NOT speaking for Pandemic Studios. "Care not what the neighbors
> # think. What are the facts, and to how many decimal places?" -R.A.
> Heinlein


From: Kerem G�mr�kc� on
Hi Joe,

>Had you shown the actual code, instead of a vague handwave,
>we might have spotted it for

The overall code is too large to paste here and i even have a lot
of inline assembly but you are right, i had to past the code here.
But its fine now,....

>You did not justify the use of VirtualAlloc,
>so it was not clear why you needed some

Again, i didnt thought it was necessary, because the question was
"why" my system was consuming heavy memory and increasing its
memory usage, but ok,...

>Had you stated why you were using VirtualAlloc and shown the code, the
>whole thing would
>have been simpler to answer.

I found the problem after the Tip from Alexander, so it was solved very
early, i think even after the third posting/first reply. So i dont think
that
we must continue here, but thanks for your effort. its really solved and
ok now,...

Regards

K.

--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."


From: Kerem G�mr�kc� on
Hi,

thanks to everybody and all answers,...

It has been solved successfully and i have learned
a lot of things again....

Regards

K.

--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."


From: Joseph M. Newcomer on
See below....
On Sun, 9 Mar 2008 12:55:51 +0100, "Kerem G�mr�kc�" <kareem114(a)hotmail.com> wrote:

>Hi Joe,
>
>>Had you shown the actual code, instead of a vague handwave,
>>we might have spotted it for
>
>The overall code is too large to paste here and i even have a lot
>of inline assembly but you are right, i had to past the code here.
>But its fine now,....
>
>>You did not justify the use of VirtualAlloc,
>>so it was not clear why you needed some
>
>Again, i didnt thought it was necessary, because the question was
>"why" my system was consuming heavy memory and increasing its
>memory usage, but ok,...
****
But the answer as to "why" would have been obvious had you posted your VirtualFree
code...you showed a 'correct' handwave, but your code did not implement what your
statement of your solution was. So, by looking at your stated solution, nothing appeared
to be wrong.

Inline assembly code? Scary...
****
>
>>Had you stated why you were using VirtualAlloc and shown the code, the
>>whole thing would
>>have been simpler to answer.
>
>I found the problem after the Tip from Alexander, so it was solved very
>early, i think even after the third posting/first reply. So i dont think
>that
>we must continue here, but thanks for your effort. its really solved and
>ok now,...
>
>Regards
>
>K.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm