Page 1 of 1

[NXC] Memory Leak

Posted: 21 Aug 2011, 05:48
by muntoo
If you try to run the attached NxProfiler-Demo.rxe, you will witness a memory leak!

It rises at about:

Image

Or (n * (n + 1) / 2) * sizeof(ULONG) which is about 2 * n^2.

Re: [NXC] Memory Leak

Posted: 23 Aug 2011, 01:12
by afanofosc
I don't know what you are trying to report here. That your code uses more and more memory as you add elements to arrays?

John Hansen

Re: [NXC] Memory Leak

Posted: 23 Aug 2011, 01:17
by muntoo
afanofosc wrote:I don't know what you are trying to report here. That your code uses more and more memory as you add elements to arrays?
Yes, but I'm only adding one element (4 bytes), and the DataspaceSize rises by the amount described in the formula above. (For example, from 49 to 50 elements, it rises by a few hundred bytes instead of the expected 4.)

The third line on the display indicates the "delta" increase in DataspaceSize.

The memory should be recycled when not in use - I know it does that normally, but for some reason it's not happening in this case. Eventually, at ~86 elements, the program gives me File Error! -1.