Re: Is there memory leak in mex programming?



Andrew wrote:
I'll add that Matlab seems to treat the output mxArrays of mex function as temporary variables. Say if you have a function:

X = MyMexFun();

If you check the memory address stored in plhs[0] it will not be the same memory address as X. So X, or in your case a(:,i), gets a copy of plhs[0] and then plhs[0] is destroyed.

The data in the array is not actually copied.

--
Steve Eddins
http://blogs.mathworks.com/steve
.



Relevant Pages

  • Re: Is there memory leak in mex programming?
    ... mex function as temporary variables. ... If you check the memory address stored in plhsit will ... and in Matlab, you call the compiled mex function ...
    (comp.soft-sys.matlab)
  • Re: Clustered W2K3 Server Memory
    ... SS also uses another memory segment know as MEM TO ... With more than 4GB, then you MUST use PAE, whether or not Win2K3 enables ... Andrew J. Kelly SQL MVP "Chris Wood" wrote in message ...
    (microsoft.public.sqlserver.server)
  • Re: Clustered W2K3 Server Memory
    ... SS also uses another memory segment know as MEM TO ... With more than 4GB, then you MUST use PAE, whether or not Win2K3 enables ... Andrew J. Kelly SQL MVP "Chris Wood" wrote in message ...
    (microsoft.public.sqlserver.setup)
  • Re: [openib-general] Re: [PATCH][RFC][0/4] InfiniBand userspace verbs implementation
    ... Andrew> The kernel can simply register and unregister ranges for ... Andrew> RDMA. ... Kernel accounting ... RDMA device, a process can create many memory ...
    (Linux-Kernel)
  • [PATCH] madvise MADV_DONTFORK/MADV_DOFORK
    ... Hugh, I gather you'll forward this to Andrew, correct? ... In case of mlock'd memory, the parent is not getting the ... Useful e.g. for when hardware is doing DMA from/into these pages. ... Could also be useful to an application wanting to speed up its forks by cutting ...
    (Linux-Kernel)