Nevron Forum
Back
Login
Register
Login
Register
Home
»
Nevron Vision for NET
»
Nevron Diagram for .NET
»
Proper way to remove shapes from DIagram? Memory leak?
Proper way to remove shapes from DIagram? Memory leak?
Post Reply
Proper
way
to
remove
shapes
from
DIagram
?
Memory
leak
?
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
Goto Topics Forum
Author
Message
Nevron Support
Nevron Support
posted 9 Years Ago
ANSWER
Post Details
Group: Administrators
Posts: 3.1K,
Visits: 4.2K
Hi
Jason
,
Yes
you
are
removing
the
shapes
correctly
.
If
the
shapes
are
however
connected
you
may
consider
the
NBatchDelete
to
perform
the
removal
.
For
an
example
see
the
following
topic
:
Diagram
for
.
NET
&
gt
;
User
'
s
Guide
&
gt
;
Document
Object
Model
&
gt
;
Batches
The
memory
leak
may
occur
if
you
locally
subscribe
for
events
of
the
shapes
for
example
like
that
:
shape
.
BoundsChanged
+=
somedelegate
;
Because
we
wanted
to
optimize
the
memory
footprint
and
performance
of
shapes
,
the
shapes
do
not
have
local
events
declared
on
them
,
but
rather
use
the
EventSinkService
to
record
"
per
node
"
events
.
This
helps
us
for
example
temporary
"
block
"
all
events
when
performance
is
required
-
for
example
during
BeginUpdate
()/
EndUpdate
()
of
the
drawing
.
You
are
right
however
that
this
can
generate
a
memory
leak
.
To
detach
a
shape
from
all
events
for
which
you
have
locally
subscribed
you
can
use
the
following
code
:
drawing
100
;
ocument
.
EventSinkService
.
RemoveAllNodeEventListeners
(
shape
);
Best Regards,
Nevron Support Team
Reply
Like
0
Jason Irby
Jason Irby
posted 9 Years Ago
ANSWER
Topic Details
Group: Forum Members
Posts: 59,
Visits: 77
1
. &
nbsp
;
What
is
the
proper
way
to
remove
a
NShape
or
NGroup
from
a
NDrawingDocument
?
2
. &
nbsp
;
What
is
the
proper
way
to
clear
out
all
shapes
from
&
nbsp
;&
nbsp
;
a
NDrawingDocument
?
I
have
been
using
:
my
100
;
ocument
.
ActiveLayer
.
RemoveChild
(
aShape
);
my
100
;
ocument
.
ActiveLayer
.
RemoveAllChildren
();
My
problem
is
that
in
testing
with
.
Net
Memory
Profiler
,
I
am
seeing
the
number
of
NGroups
continue
to
grow
even
though
I
thought
I
had
removed
them
. &
nbsp
;
They
seem
to
be
held
by
the
100
;
ocument
.
EventSinkService
in
a
field
call
"|
1
|||
I
||"
what
ever
the
heck
that
is
.
AM
I
doing
it
right
?
Thanks
in
advance
.
Jason
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search