memory handling with properties

From: Eric (bauersachs_at_kull.ch.nospam.me.com)
Date: 09/30/04


Date: Thu, 30 Sep 2004 19:23:13 +0200

How does memory handling of the properties work exactly?

The structure SPropValue.Value contains only pointers (for strings etc.). If
the properties are moved around, then I must pay great attention to all the
memory allocations.

I have seen that in the implementation of GetProps someone has declared a
local variable on the stack like
TCHAR szContainerName[64];
and then used a pointer to that variable in the SPropValue.Value.lpszA which
was used in IMAPIProp::GetProps and SetProps. I've seen this in the
implementation as well as for callers. Is this correct? Isn't the stack
destroyed before the caller can access the variables? Or is this only true
for implementators, not for callers?
When and how do I have to allocate the memory with MAPIAllocateMore /
MAPIFreeBuffer exactly?
When is it ok to use stack variables?
Can someone shed a little light on this issue?

Eric Bauersachs



Relevant Pages

  • Re: HP48 : recursion : more and more slower
    ... CPU and from there into memory. ... So, memory changes, the system goes through all pointers (keeps track ... The stack is just an sequence of pointers. ...
    (comp.sys.hp48)
  • Re: HP48 : recursion : more and more slower
    ... However Available memory are sufficient... ... objects on the stack and you will notice how the whole calc slows ... the system has to keep track of the pointers shown in the "normal ... Is it an internal operation of RPL operating system, ...
    (comp.sys.hp48)
  • Re: Preventing exploitation with rebasing
    ... which would tell us what segments were ... The best way to think of the NDS represntation of pointers is as tokens. ... therefor puts memory addresses (sometimes actual pointers to kernel ... but it turned out to be just a part of my stack.) ...
    (Bugtraq)
  • Re: Arrays
    ... cannot use pointers. ... say that basically when you pass an array, you ARE passing a pointer. ... the memory allocated for the call stack is returned to the ... and any parameters become garbage in unused memory. ...
    (microsoft.public.vb.controls)
  • Re: where does function reside in memory in C++
    ... the pointers point to? ... Is it stack or heap? ... pre-allocates memory and copies the binary ...
    (microsoft.public.dotnet.languages.vc)