--
You received this message because you are subscribed to the Google Groups "ninject" group.
To post to this group, send email to nin...@googlegroups.com.
To unsubscribe from this group, send email to ninject+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ninject?hl=en.
I did a quick check on the Ninject properties and this is what I get…
this.Kernel.Settings.CachePruningInterval
I checked the internal, it is 30 seconds
It is read only property.
The help says that it prunes the cache memory at certain intervals.
Now i am keeping my application ideal for long time to give some time to Ninject the release some memory. I am taking the memory reading after 30 sec, 60 sec and 120 sec. But I am not finding any difference in memory. It's not releasing the memory.
If i dispose the kernel object, I am getting all the memory back. But without kernel dispose i am not getting memory back.
Thanks & Regards,
Nishith
Finally, I question the validity of using GC.GetTotalMemory, so much
else can happen in the runtime to create memory in separate threads
that you can't control that the test has the possibility of randomly
failing and I don't like tests that can randomly fail.
Remo
I agree to your comments, but the point I make is related to the difference between compact framework version and the normal version for Ninject
We get good results for normal windows version of Ninject
But with compact framework we have noticed that the memory is consumed for each Kernel.Get<T>, even if T is of same type.
for (var i = 1; i <= 100; i++)
{
var fruit = this.kernel.Get<IFruit>();
GC.Collect();
var end = GC.GetTotalMemory(true);
}
As already said it's not that easy. So much is going on internally. If
you want to check if there is no memory leak the only way to profe is
to use a memory profiler an analyze all the new/changed objects.
E.g. there are collections involved that get cleaned at a configurable
interval. But the .NET implementation of the collections will only
delete the referenced objects but keep the internal data structures
for the size that was used. This internal data structure is reused and
only grow if more space is required.
On May 17, 6:29 am, Nishith Desai <ndesai1...@gmail.com> wrote:
> The thing you are telling about Get(), memory consumption should be O(1),
> not O(n) (where n is the number of identical calls to .Get()). This is not
> happening. First Get() call is consuming approx 3 to 4 kb in .Net compact
> framework and around 9k in win32. After that every Get() call is consuming
> 32 bytes of GC memory in .Net Compact framework. These 32 bytes are
> concerned for me.
>
>
>
>
>
>
>
> On Fri, May 13, 2011 at 11:05 PM, Joe Wasson <jwas...@gmail.com> wrote:
> > Your tests are flawed. By virtue of asking for a type Ninject will
> > create some internal data structures, as Remo said. That is not a
> > memory leak as you say, when you dispose the kernel object you get the
> > memory back. The thing you need to be testing is that memory does not
> > increase as a function of calls to .Get(). The first call to .Get()
> > will create memory as those structures are created and retained but
> > subsequent cals to .Get() should not be creating additional memory.
> > In other words, memory consumption should be O(1), not O(n) (where n
> > is the number of identical calls to .Get()). You will also want to
> > check that no actual fruit objects are being leaked, probably by
> > creating a static member that is InterlockIncremented on create and
> > InterlockDecremented on finalize.
>
> > Finally, I question the validity of using GC.GetTotalMemory, so much
> > else can happen in the runtime to create memory in separate threads
> > that you can't control that the test has the possibility of randomly
> > failing and I don't like tests that can randomly fail.
>
> > On Fri, May 13, 2011 at 5:21 AM, Nishith Desai <ndesai1...@gmail.com>
> > wrote:
> > > I did a quick check on the Ninject properties and this is what I get…
>
> > > this.Kernel.Settings.CachePruningInterval
>
> > > I checked the internal, it is 30 seconds
>
> > > It is read only property.
>
> > > The help says that it prunes the cache memory at certain intervals.
>
> > > Now i am keeping my application ideal for long time to give some time to
> > > Ninject the release some memory. I am taking the memory reading after 30
> > > sec, 60 sec and 120 sec. But I am not finding any difference in memory.
> > It's
> > > not releasing the memory.
>
> > > If i dispose the kernel object, I am getting all the memory back. But
> > > without kernel dispose i am not getting memory back.
>
> > > Thanks & Regards,
>
> > > Nishith
>
> > > On Wed, May 11, 2011 at 11:25 AM, Nishith Desai <ndesai1...@gmail.com>
> > > wrote:
>
> > >> Thanks for the information.
> > >> How I can configure the Interval? Where I can find this?
>
> > >> Thanks & Regards,
> > >> Nishith
>